data.relMathlib.Data.Rel

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2018 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Mathbin.Order.CompleteLattice
-import Mathbin.Order.GaloisConnection
+import Order.CompleteLattice
+import Order.GaloisConnection
 
 #align_import data.rel from "leanprover-community/mathlib"@"c3291da49cfa65f0d43b094750541c0731edc932"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2018 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.rel
-! leanprover-community/mathlib commit c3291da49cfa65f0d43b094750541c0731edc932
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Order.CompleteLattice
 import Mathbin.Order.GaloisConnection
 
+#align_import data.rel from "leanprover-community/mathlib"@"c3291da49cfa65f0d43b094750541c0731edc932"
+
 /-!
 # Relations
 
Diff
@@ -66,7 +66,7 @@ theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
 -/
 
 #print Rel.inv_inv /-
-theorem inv_inv : inv (inv r) = r := by ext (x y); rfl
+theorem inv_inv : inv (inv r) = r := by ext x y; rfl
 #align rel.inv_inv Rel.inv_inv
 -/
 
@@ -90,12 +90,12 @@ def codom :=
 -/
 
 #print Rel.codom_inv /-
-theorem codom_inv : r.inv.codom = r.dom := by ext (x y); rfl
+theorem codom_inv : r.inv.codom = r.dom := by ext x y; rfl
 #align rel.codom_inv Rel.codom_inv
 -/
 
 #print Rel.dom_inv /-
-theorem dom_inv : r.inv.dom = r.codom := by ext (x y); rfl
+theorem dom_inv : r.inv.dom = r.codom := by ext x y; rfl
 #align rel.dom_inv Rel.dom_inv
 -/
 
@@ -110,7 +110,7 @@ local infixr:0 " ∘ " => Rel.comp
 #print Rel.comp_assoc /-
 theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : ((r ∘ s) ∘ t) = (r ∘ s ∘ t) :=
   by
-  unfold comp; ext (x w); constructor
+  unfold comp; ext x w; constructor
   · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
   rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
 #align rel.comp_assoc Rel.comp_assoc
@@ -129,12 +129,12 @@ theorem comp_left_id (r : Rel α β) : (@Eq α ∘ r) = r := by unfold comp; ext
 -/
 
 #print Rel.inv_id /-
-theorem inv_id : inv (@Eq α) = @Eq α := by ext (x y); constructor <;> apply Eq.symm
+theorem inv_id : inv (@Eq α) = @Eq α := by ext x y; constructor <;> apply Eq.symm
 #align rel.inv_id Rel.inv_id
 -/
 
 #print Rel.inv_comp /-
-theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) := by ext (x z);
+theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) := by ext x z;
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
 -/
Diff
@@ -59,12 +59,16 @@ def inv : Rel β α :=
 #align rel.inv Rel.inv
 -/
 
+#print Rel.inv_def /-
 theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
   Iff.rfl
 #align rel.inv_def Rel.inv_def
+-/
 
+#print Rel.inv_inv /-
 theorem inv_inv : inv (inv r) = r := by ext (x y); rfl
 #align rel.inv_inv Rel.inv_inv
+-/
 
 #print Rel.dom /-
 /-- Domain of a relation -/
@@ -73,8 +77,10 @@ def dom :=
 #align rel.dom Rel.dom
 -/
 
+#print Rel.dom_mono /-
 theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩
 #align rel.dom_mono Rel.dom_mono
+-/
 
 #print Rel.codom /-
 /-- Codomain aka range of a relation -/
@@ -83,8 +89,10 @@ def codom :=
 #align rel.codom Rel.codom
 -/
 
+#print Rel.codom_inv /-
 theorem codom_inv : r.inv.codom = r.dom := by ext (x y); rfl
 #align rel.codom_inv Rel.codom_inv
+-/
 
 #print Rel.dom_inv /-
 theorem dom_inv : r.inv.dom = r.codom := by ext (x y); rfl
@@ -97,32 +105,39 @@ def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y
 #align rel.comp Rel.comp
 -/
 
--- mathport name: rel.comp
 local infixr:0 " ∘ " => Rel.comp
 
+#print Rel.comp_assoc /-
 theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : ((r ∘ s) ∘ t) = (r ∘ s ∘ t) :=
   by
   unfold comp; ext (x w); constructor
   · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
   rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
 #align rel.comp_assoc Rel.comp_assoc
+-/
 
+#print Rel.comp_right_id /-
 @[simp]
 theorem comp_right_id (r : Rel α β) : (r ∘ @Eq β) = r := by unfold comp; ext y; simp
 #align rel.comp_right_id Rel.comp_right_id
+-/
 
+#print Rel.comp_left_id /-
 @[simp]
 theorem comp_left_id (r : Rel α β) : (@Eq α ∘ r) = r := by unfold comp; ext x; simp
 #align rel.comp_left_id Rel.comp_left_id
+-/
 
 #print Rel.inv_id /-
 theorem inv_id : inv (@Eq α) = @Eq α := by ext (x y); constructor <;> apply Eq.symm
 #align rel.inv_id Rel.inv_id
 -/
 
+#print Rel.inv_comp /-
 theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) := by ext (x z);
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
+-/
 
 #print Rel.image /-
 /-- Image of a set under a relation -/
@@ -131,28 +146,38 @@ def image (s : Set α) : Set β :=
 #align rel.image Rel.image
 -/
 
+#print Rel.mem_image /-
 theorem mem_image (y : β) (s : Set α) : y ∈ image r s ↔ ∃ x ∈ s, r x y :=
   Iff.rfl
 #align rel.mem_image Rel.mem_image
+-/
 
+#print Rel.image_subset /-
 theorem image_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.image r.image := fun s t h y ⟨x, xs, rxy⟩ =>
   ⟨x, h xs, rxy⟩
 #align rel.image_subset Rel.image_subset
+-/
 
+#print Rel.image_mono /-
 theorem image_mono : Monotone r.image :=
   r.image_subset
 #align rel.image_mono Rel.image_mono
+-/
 
+#print Rel.image_inter /-
 theorem image_inter (s t : Set α) : r.image (s ∩ t) ⊆ r.image s ∩ r.image t :=
   r.image_mono.map_inf_le s t
 #align rel.image_inter Rel.image_inter
+-/
 
+#print Rel.image_union /-
 theorem image_union (s t : Set α) : r.image (s ∪ t) = r.image s ∪ r.image t :=
   le_antisymm
     (fun y ⟨x, xst, rxy⟩ =>
       xst.elim (fun xs => Or.inl ⟨x, ⟨xs, rxy⟩⟩) fun xt => Or.inr ⟨x, ⟨xt, rxy⟩⟩)
     (r.image_mono.le_map_sup s t)
 #align rel.image_union Rel.image_union
+-/
 
 #print Rel.image_id /-
 @[simp]
@@ -160,12 +185,14 @@ theorem image_id (s : Set α) : image (@Eq α) s = s := by ext x; simp [mem_imag
 #align rel.image_id Rel.image_id
 -/
 
+#print Rel.image_comp /-
 theorem image_comp (s : Rel β γ) (t : Set α) : image (r ∘ s) t = image s (image r t) :=
   by
   ext z; simp only [mem_image]; constructor
   · rintro ⟨x, xt, y, rxy, syz⟩; exact ⟨y, ⟨x, xt, rxy⟩, syz⟩
   rintro ⟨y, ⟨x, xt, rxy⟩, syz⟩; exact ⟨x, xt, y, rxy, syz⟩
 #align rel.image_comp Rel.image_comp
+-/
 
 #print Rel.image_univ /-
 theorem image_univ : r.image Set.univ = r.codom := by ext y; simp [mem_image, codom]
@@ -179,13 +206,17 @@ def preimage (s : Set β) : Set α :=
 #align rel.preimage Rel.preimage
 -/
 
+#print Rel.mem_preimage /-
 theorem mem_preimage (x : α) (s : Set β) : x ∈ r.Preimage s ↔ ∃ y ∈ s, r x y :=
   Iff.rfl
 #align rel.mem_preimage Rel.mem_preimage
+-/
 
+#print Rel.preimage_def /-
 theorem preimage_def (s : Set β) : preimage r s = {x | ∃ y ∈ s, r x y} :=
   Set.ext fun x => mem_preimage _ _ _
 #align rel.preimage_def Rel.preimage_def
+-/
 
 #print Rel.preimage_mono /-
 theorem preimage_mono {s t : Set β} (h : s ⊆ t) : r.Preimage s ⊆ r.Preimage t :=
@@ -193,13 +224,17 @@ theorem preimage_mono {s t : Set β} (h : s ⊆ t) : r.Preimage s ⊆ r.Preimage
 #align rel.preimage_mono Rel.preimage_mono
 -/
 
+#print Rel.preimage_inter /-
 theorem preimage_inter (s t : Set β) : r.Preimage (s ∩ t) ⊆ r.Preimage s ∩ r.Preimage t :=
   image_inter _ s t
 #align rel.preimage_inter Rel.preimage_inter
+-/
 
+#print Rel.preimage_union /-
 theorem preimage_union (s t : Set β) : r.Preimage (s ∪ t) = r.Preimage s ∪ r.Preimage t :=
   image_union _ s t
 #align rel.preimage_union Rel.preimage_union
+-/
 
 #print Rel.preimage_id /-
 theorem preimage_id (s : Set α) : preimage (@Eq α) s = s := by
@@ -207,12 +242,16 @@ theorem preimage_id (s : Set α) : preimage (@Eq α) s = s := by
 #align rel.preimage_id Rel.preimage_id
 -/
 
+#print Rel.preimage_comp /-
 theorem preimage_comp (s : Rel β γ) (t : Set γ) : preimage (r ∘ s) t = preimage r (preimage s t) :=
   by simp only [preimage, inv_comp, image_comp]
 #align rel.preimage_comp Rel.preimage_comp
+-/
 
+#print Rel.preimage_univ /-
 theorem preimage_univ : r.Preimage Set.univ = r.dom := by rw [preimage, image_univ, codom_inv]
 #align rel.preimage_univ Rel.preimage_univ
+-/
 
 #print Rel.core /-
 /-- Core of a set `s : set β` w.r.t `r : rel α β` is the set of `x : α` that are related *only*
@@ -233,34 +272,44 @@ theorem core_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.core r.core := fun s t h x
 #align rel.core_subset Rel.core_subset
 -/
 
+#print Rel.core_mono /-
 theorem core_mono : Monotone r.core :=
   r.core_subset
 #align rel.core_mono Rel.core_mono
+-/
 
+#print Rel.core_inter /-
 theorem core_inter (s t : Set β) : r.core (s ∩ t) = r.core s ∩ r.core t :=
   Set.ext (by simp [mem_core, imp_and, forall_and])
 #align rel.core_inter Rel.core_inter
+-/
 
+#print Rel.core_union /-
 theorem core_union (s t : Set β) : r.core s ∪ r.core t ⊆ r.core (s ∪ t) :=
   r.core_mono.le_map_sup s t
 #align rel.core_union Rel.core_union
+-/
 
+#print Rel.core_univ /-
 @[simp]
 theorem core_univ : r.core Set.univ = Set.univ :=
   Set.ext (by simp [mem_core])
 #align rel.core_univ Rel.core_univ
+-/
 
 #print Rel.core_id /-
 theorem core_id (s : Set α) : core (@Eq α) s = s := by simp [core]
 #align rel.core_id Rel.core_id
 -/
 
+#print Rel.core_comp /-
 theorem core_comp (s : Rel β γ) (t : Set γ) : core (r ∘ s) t = core r (core s t) :=
   by
   ext x; simp [core, comp]; constructor
   · exact fun h y rxy z => h z y rxy
   · exact fun h z y rzy => h y rzy z
 #align rel.core_comp Rel.core_comp
+-/
 
 #print Rel.restrictDomain /-
 /-- Restrict the domain of a relation to a subtype. -/
@@ -268,13 +317,17 @@ def restrictDomain (s : Set α) : Rel { x // x ∈ s } β := fun x y => r x.val
 #align rel.restrict_domain Rel.restrictDomain
 -/
 
+#print Rel.image_subset_iff /-
 theorem image_subset_iff (s : Set α) (t : Set β) : image r s ⊆ t ↔ s ⊆ core r t :=
   Iff.intro (fun h x xs y rxy => h ⟨x, xs, rxy⟩) fun h y ⟨x, xs, rxy⟩ => h xs y rxy
 #align rel.image_subset_iff Rel.image_subset_iff
+-/
 
+#print Rel.image_core_gc /-
 theorem image_core_gc : GaloisConnection r.image r.core :=
   image_subset_iff _
 #align rel.image_core_gc Rel.image_core_gc
+-/
 
 end Rel
 
@@ -290,11 +343,13 @@ end Function
 
 namespace Set
 
+#print Set.image_eq /-
 -- TODO: if image were defined with bounded quantification in corelib, the next two would
 -- be definitional
 theorem image_eq (f : α → β) (s : Set α) : f '' s = (Function.graph f).image s := by
   simp [Set.image, Function.graph, Rel.image]
 #align set.image_eq Set.image_eq
+-/
 
 #print Set.preimage_eq /-
 theorem preimage_eq (f : α → β) (s : Set β) : f ⁻¹' s = (Function.graph f).Preimage s := by
Diff
@@ -69,7 +69,7 @@ theorem inv_inv : inv (inv r) = r := by ext (x y); rfl
 #print Rel.dom /-
 /-- Domain of a relation -/
 def dom :=
-  { x | ∃ y, r x y }
+  {x | ∃ y, r x y}
 #align rel.dom Rel.dom
 -/
 
@@ -79,7 +79,7 @@ theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b
 #print Rel.codom /-
 /-- Codomain aka range of a relation -/
 def codom :=
-  { y | ∃ x, r x y }
+  {y | ∃ x, r x y}
 #align rel.codom Rel.codom
 -/
 
@@ -127,7 +127,7 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ in
 #print Rel.image /-
 /-- Image of a set under a relation -/
 def image (s : Set α) : Set β :=
-  { y | ∃ x ∈ s, r x y }
+  {y | ∃ x ∈ s, r x y}
 #align rel.image Rel.image
 -/
 
@@ -183,7 +183,7 @@ theorem mem_preimage (x : α) (s : Set β) : x ∈ r.Preimage s ↔ ∃ y ∈ s,
   Iff.rfl
 #align rel.mem_preimage Rel.mem_preimage
 
-theorem preimage_def (s : Set β) : preimage r s = { x | ∃ y ∈ s, r x y } :=
+theorem preimage_def (s : Set β) : preimage r s = {x | ∃ y ∈ s, r x y} :=
   Set.ext fun x => mem_preimage _ _ _
 #align rel.preimage_def Rel.preimage_def
 
@@ -218,7 +218,7 @@ theorem preimage_univ : r.Preimage Set.univ = r.dom := by rw [preimage, image_un
 /-- 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 β) :=
-  { x | ∀ y, r x y → y ∈ s }
+  {x | ∀ y, r x y → y ∈ s}
 #align rel.core Rel.core
 -/
 
Diff
@@ -43,7 +43,8 @@ variable {α β γ : Type _}
 #print Rel /-
 /-- A relation on `α` and `β`, aka a set-valued function, aka a partial multifunction -/
 def Rel (α β : Type _) :=
-  α → β → Prop deriving CompleteLattice, Inhabited
+  α → β → Prop
+deriving CompleteLattice, Inhabited
 #align rel Rel
 -/
 
Diff
@@ -58,22 +58,10 @@ def inv : Rel β α :=
 #align rel.inv Rel.inv
 -/
 
-/- warning: rel.inv_def -> Rel.inv_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (x : α) (y : β), Iff (Rel.inv.{u1, u2} α β r y x) (r x y)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β) (x : α) (y : β), Iff (Rel.inv.{u2, u1} α β r y x) (r x y)
-Case conversion may be inaccurate. Consider using '#align rel.inv_def Rel.inv_defₓ'. -/
 theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
   Iff.rfl
 #align rel.inv_def Rel.inv_def
 
-/- warning: rel.inv_inv -> Rel.inv_inv is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{max (succ u1) (succ u2)} (Rel.{u1, u2} α β) (Rel.inv.{u2, u1} β α (Rel.inv.{u1, u2} α β r)) r
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.inv.{u1, u2} β α (Rel.inv.{u2, u1} α β r)) r
-Case conversion may be inaccurate. Consider using '#align rel.inv_inv Rel.inv_invₓ'. -/
 theorem inv_inv : inv (inv r) = r := by ext (x y); rfl
 #align rel.inv_inv Rel.inv_inv
 
@@ -84,12 +72,6 @@ def dom :=
 #align rel.dom Rel.dom
 -/
 
-/- warning: rel.dom_mono -> Rel.dom_mono is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : Rel.{u1, u2} α β} {s : Rel.{u1, u2} α β}, (LE.le.{max u1 u2} (Rel.{u1, u2} α β) (Preorder.toHasLe.{max u1 u2} (Rel.{u1, u2} α β) (PartialOrder.toPreorder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteSemilatticeInf.toPartialOrder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteLattice.toCompleteSemilatticeInf.{max u1 u2} (Rel.{u1, u2} α β) (Rel.completeLattice.{u1, u2} α β))))) r s) -> (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Rel.dom.{u1, u2} α β r) (Rel.dom.{u1, u2} α β s))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {r : Rel.{u2, u1} α β} {s : Rel.{u2, u1} α β}, (LE.le.{max u2 u1} (Rel.{u2, u1} α β) (Preorder.toLE.{max u2 u1} (Rel.{u2, u1} α β) (PartialOrder.toPreorder.{max u2 u1} (Rel.{u2, u1} α β) (CompleteSemilatticeInf.toPartialOrder.{max u2 u1} (Rel.{u2, u1} α β) (CompleteLattice.toCompleteSemilatticeInf.{max u2 u1} (Rel.{u2, u1} α β) (instCompleteLatticeRel.{u2, u1} α β))))) r s) -> (HasSubset.Subset.{u2} (Set.{u2} α) (Set.instHasSubsetSet.{u2} α) (Rel.dom.{u2, u1} α β r) (Rel.dom.{u2, u1} α β s))
-Case conversion may be inaccurate. Consider using '#align rel.dom_mono Rel.dom_monoₓ'. -/
 theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩
 #align rel.dom_mono Rel.dom_mono
 
@@ -100,12 +82,6 @@ def codom :=
 #align rel.codom Rel.codom
 -/
 
-/- warning: rel.codom_inv -> Rel.codom_inv is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{succ u1} (Set.{u1} α) (Rel.codom.{u2, u1} β α (Rel.inv.{u1, u2} α β r)) (Rel.dom.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{succ u2} (Set.{u2} α) (Rel.codom.{u1, u2} β α (Rel.inv.{u2, u1} α β r)) (Rel.dom.{u2, u1} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.codom_inv Rel.codom_invₓ'. -/
 theorem codom_inv : r.inv.codom = r.dom := by ext (x y); rfl
 #align rel.codom_inv Rel.codom_inv
 
@@ -123,12 +99,6 @@ def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y
 -- mathport name: rel.comp
 local infixr:0 " ∘ " => Rel.comp
 
-/- warning: rel.comp_assoc -> Rel.comp_assoc is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} (r : Rel.{u1, u2} α β) (s : Rel.{u2, u3} β γ) (t : Rel.{u3, u4} γ δ), Eq.{max (succ u1) (succ u4)} (Rel.{u1, u4} α δ) (Rel.comp.{u1, u3, u4} α γ δ (Rel.comp.{u1, u2, u3} α β γ r s) t) (Rel.comp.{u1, u2, u4} α β δ r (Rel.comp.{u2, u3, u4} β γ δ s t))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} {δ : Type.{u4}} (r : Rel.{u3, u2} α β) (s : Rel.{u2, u1} β γ) (t : Rel.{u1, u4} γ δ), Eq.{max (succ u3) (succ u4)} (Rel.{u3, u4} α δ) (Rel.comp.{u3, u1, u4} α γ δ (Rel.comp.{u3, u2, u1} α β γ r s) t) (Rel.comp.{u3, u2, u4} α β δ r (Rel.comp.{u2, u1, u4} β γ δ s t))
-Case conversion may be inaccurate. Consider using '#align rel.comp_assoc Rel.comp_assocₓ'. -/
 theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : ((r ∘ s) ∘ t) = (r ∘ s ∘ t) :=
   by
   unfold comp; ext (x w); constructor
@@ -136,22 +106,10 @@ theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : ((r ∘ s)
   rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
 #align rel.comp_assoc Rel.comp_assoc
 
-/- warning: rel.comp_right_id -> Rel.comp_right_id is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{max (succ u1) (succ u2)} (Rel.{u1, u2} α β) (Rel.comp.{u1, u2, u2} α β β r (Eq.{succ u2} β)) r
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.comp.{u2, u1, u1} α β β r (Eq.{succ u1} β)) r
-Case conversion may be inaccurate. Consider using '#align rel.comp_right_id Rel.comp_right_idₓ'. -/
 @[simp]
 theorem comp_right_id (r : Rel α β) : (r ∘ @Eq β) = r := by unfold comp; ext y; simp
 #align rel.comp_right_id Rel.comp_right_id
 
-/- warning: rel.comp_left_id -> Rel.comp_left_id is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{max (succ u1) (succ u2)} (Rel.{u1, u2} α β) (Rel.comp.{u1, u1, u2} α α β (Eq.{succ u1} α) r) r
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.comp.{u2, u2, u1} α α β (Eq.{succ u2} α) r) r
-Case conversion may be inaccurate. Consider using '#align rel.comp_left_id Rel.comp_left_idₓ'. -/
 @[simp]
 theorem comp_left_id (r : Rel α β) : (@Eq α ∘ r) = r := by unfold comp; ext x; simp
 #align rel.comp_left_id Rel.comp_left_id
@@ -161,12 +119,6 @@ theorem inv_id : inv (@Eq α) = @Eq α := by ext (x y); constructor <;> apply Eq
 #align rel.inv_id Rel.inv_id
 -/
 
-/- warning: rel.inv_comp -> Rel.inv_comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (r : Rel.{u1, u2} α β) (s : Rel.{u2, u3} β γ), Eq.{max (succ u3) (succ u1)} (Rel.{u3, u1} γ α) (Rel.inv.{u1, u3} α γ (Rel.comp.{u1, u2, u3} α β γ r s)) (Rel.comp.{u3, u2, u1} γ β α (Rel.inv.{u2, u3} β γ s) (Rel.inv.{u1, u2} α β r))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (r : Rel.{u3, u2} α β) (s : Rel.{u2, u1} β γ), Eq.{max (succ u3) (succ u1)} (Rel.{u1, u3} γ α) (Rel.inv.{u3, u1} α γ (Rel.comp.{u3, u2, u1} α β γ r s)) (Rel.comp.{u1, u2, u3} γ β α (Rel.inv.{u2, u1} β γ s) (Rel.inv.{u3, u2} α β r))
-Case conversion may be inaccurate. Consider using '#align rel.inv_comp Rel.inv_compₓ'. -/
 theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) := by ext (x z);
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
@@ -178,52 +130,22 @@ def image (s : Set α) : Set β :=
 #align rel.image Rel.image
 -/
 
-/- warning: rel.mem_image -> Rel.mem_image is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (y : β) (s : Set.{u1} α), Iff (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) y (Rel.image.{u1, u2} α β r s)) (Exists.{succ u1} α (fun (x : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x s) (fun (H : Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x s) => r x y)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β) (y : β) (s : Set.{u2} α), Iff (Membership.mem.{u1, u1} β (Set.{u1} β) (Set.instMembershipSet.{u1} β) y (Rel.image.{u2, u1} α β r s)) (Exists.{succ u2} α (fun (x : α) => And (Membership.mem.{u2, u2} α (Set.{u2} α) (Set.instMembershipSet.{u2} α) x s) (r x y)))
-Case conversion may be inaccurate. Consider using '#align rel.mem_image Rel.mem_imageₓ'. -/
 theorem mem_image (y : β) (s : Set α) : y ∈ image r s ↔ ∃ x ∈ s, r x y :=
   Iff.rfl
 #align rel.mem_image Rel.mem_image
 
-/- warning: rel.image_subset -> Rel.image_subset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Relator.LiftFun.{succ u1, succ u1, succ u2, succ u2} (Set.{u1} α) (Set.{u1} α) (Set.{u2} β) (Set.{u2} β) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α)) (HasSubset.Subset.{u2} (Set.{u2} β) (Set.hasSubset.{u2} β)) (Rel.image.{u1, u2} α β r) (Rel.image.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Relator.LiftFun.{succ u2, succ u2, succ u1, succ u1} (Set.{u2} α) (Set.{u2} α) (Set.{u1} β) (Set.{u1} β) (fun (x._@.Mathlib.Data.Rel._hyg.1441 : Set.{u2} α) (x._@.Mathlib.Data.Rel._hyg.1443 : Set.{u2} α) => HasSubset.Subset.{u2} (Set.{u2} α) (Set.instHasSubsetSet.{u2} α) x._@.Mathlib.Data.Rel._hyg.1441 x._@.Mathlib.Data.Rel._hyg.1443) (fun (x._@.Mathlib.Data.Rel._hyg.1456 : Set.{u1} β) (x._@.Mathlib.Data.Rel._hyg.1458 : Set.{u1} β) => HasSubset.Subset.{u1} (Set.{u1} β) (Set.instHasSubsetSet.{u1} β) x._@.Mathlib.Data.Rel._hyg.1456 x._@.Mathlib.Data.Rel._hyg.1458) (Rel.image.{u2, u1} α β r) (Rel.image.{u2, u1} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.image_subset Rel.image_subsetₓ'. -/
 theorem image_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.image r.image := fun s t h y ⟨x, xs, rxy⟩ =>
   ⟨x, h xs, rxy⟩
 #align rel.image_subset Rel.image_subset
 
-/- warning: rel.image_mono -> Rel.image_mono is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Monotone.{u1, u2} (Set.{u1} α) (Set.{u2} β) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (Lattice.toSemilatticeInf.{u1} (Set.{u1} α) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} α) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))))))) (PartialOrder.toPreorder.{u2} (Set.{u2} β) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} β) (Lattice.toSemilatticeInf.{u2} (Set.{u2} β) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} β) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} β) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u2} (Set.{u2} β) (Set.booleanAlgebra.{u2} β))))))) (Rel.image.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Monotone.{u2, u1} (Set.{u2} α) (Set.{u1} β) (PartialOrder.toPreorder.{u2} (Set.{u2} α) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} α) (Lattice.toSemilatticeInf.{u2} (Set.{u2} α) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} α) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} α) (BiheytingAlgebra.toCoheytingAlgebra.{u2} (Set.{u2} α) (BooleanAlgebra.toBiheytingAlgebra.{u2} (Set.{u2} α) (Set.instBooleanAlgebraSet.{u2} α)))))))) (PartialOrder.toPreorder.{u1} (Set.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} β) (Lattice.toSemilatticeInf.{u1} (Set.{u1} β) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} β) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} β) (BiheytingAlgebra.toCoheytingAlgebra.{u1} (Set.{u1} β) (BooleanAlgebra.toBiheytingAlgebra.{u1} (Set.{u1} β) (Set.instBooleanAlgebraSet.{u1} β)))))))) (Rel.image.{u2, u1} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.image_mono Rel.image_monoₓ'. -/
 theorem image_mono : Monotone r.image :=
   r.image_subset
 #align rel.image_mono Rel.image_mono
 
-/- warning: rel.image_inter -> Rel.image_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u1} α) (t : Set.{u1} α), HasSubset.Subset.{u2} (Set.{u2} β) (Set.hasSubset.{u2} β) (Rel.image.{u1, u2} α β r (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) s t)) (Inter.inter.{u2} (Set.{u2} β) (Set.hasInter.{u2} β) (Rel.image.{u1, u2} α β r s) (Rel.image.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β) (s : Set.{u2} α) (t : Set.{u2} α), HasSubset.Subset.{u1} (Set.{u1} β) (Set.instHasSubsetSet.{u1} β) (Rel.image.{u2, u1} α β r (Inter.inter.{u2} (Set.{u2} α) (Set.instInterSet.{u2} α) s t)) (Inter.inter.{u1} (Set.{u1} β) (Set.instInterSet.{u1} β) (Rel.image.{u2, u1} α β r s) (Rel.image.{u2, u1} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.image_inter Rel.image_interₓ'. -/
 theorem image_inter (s t : Set α) : r.image (s ∩ t) ⊆ r.image s ∩ r.image t :=
   r.image_mono.map_inf_le s t
 #align rel.image_inter Rel.image_inter
 
-/- warning: rel.image_union -> Rel.image_union is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u1} α) (t : Set.{u1} α), Eq.{succ u2} (Set.{u2} β) (Rel.image.{u1, u2} α β r (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) s t)) (Union.union.{u2} (Set.{u2} β) (Set.hasUnion.{u2} β) (Rel.image.{u1, u2} α β r s) (Rel.image.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β) (s : Set.{u2} α) (t : Set.{u2} α), Eq.{succ u1} (Set.{u1} β) (Rel.image.{u2, u1} α β r (Union.union.{u2} (Set.{u2} α) (Set.instUnionSet.{u2} α) s t)) (Union.union.{u1} (Set.{u1} β) (Set.instUnionSet.{u1} β) (Rel.image.{u2, u1} α β r s) (Rel.image.{u2, u1} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.image_union Rel.image_unionₓ'. -/
 theorem image_union (s t : Set α) : r.image (s ∪ t) = r.image s ∪ r.image t :=
   le_antisymm
     (fun y ⟨x, xst, rxy⟩ =>
@@ -237,12 +159,6 @@ theorem image_id (s : Set α) : image (@Eq α) s = s := by ext x; simp [mem_imag
 #align rel.image_id Rel.image_id
 -/
 
-/- warning: rel.image_comp -> Rel.image_comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (r : Rel.{u1, u2} α β) (s : Rel.{u2, u3} β γ) (t : Set.{u1} α), Eq.{succ u3} (Set.{u3} γ) (Rel.image.{u1, u3} α γ (Rel.comp.{u1, u2, u3} α β γ r s) t) (Rel.image.{u2, u3} β γ s (Rel.image.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} (r : Rel.{u1, u3} α β) (s : Rel.{u3, u2} β γ) (t : Set.{u1} α), Eq.{succ u2} (Set.{u2} γ) (Rel.image.{u1, u2} α γ (Rel.comp.{u1, u3, u2} α β γ r s) t) (Rel.image.{u3, u2} β γ s (Rel.image.{u1, u3} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.image_comp Rel.image_compₓ'. -/
 theorem image_comp (s : Rel β γ) (t : Set α) : image (r ∘ s) t = image s (image r t) :=
   by
   ext z; simp only [mem_image]; constructor
@@ -262,22 +178,10 @@ def preimage (s : Set β) : Set α :=
 #align rel.preimage Rel.preimage
 -/
 
-/- warning: rel.mem_preimage -> Rel.mem_preimage is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (x : α) (s : Set.{u2} β), Iff (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) x (Rel.preimage.{u1, u2} α β r s)) (Exists.{succ u2} β (fun (y : β) => Exists.{0} (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) y s) (fun (H : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) y s) => r x y)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (x : α) (s : Set.{u2} β), Iff (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) x (Rel.preimage.{u1, u2} α β r s)) (Exists.{succ u2} β (fun (y : β) => And (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) y s) (r x y)))
-Case conversion may be inaccurate. Consider using '#align rel.mem_preimage Rel.mem_preimageₓ'. -/
 theorem mem_preimage (x : α) (s : Set β) : x ∈ r.Preimage s ↔ ∃ y ∈ s, r x y :=
   Iff.rfl
 #align rel.mem_preimage Rel.mem_preimage
 
-/- warning: rel.preimage_def -> Rel.preimage_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α β r s) (setOf.{u1} α (fun (x : α) => Exists.{succ u2} β (fun (y : β) => Exists.{0} (Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) y s) (fun (H : Membership.Mem.{u2, u2} β (Set.{u2} β) (Set.hasMem.{u2} β) y s) => r x y))))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α β r s) (setOf.{u1} α (fun (x : α) => Exists.{succ u2} β (fun (y : β) => And (Membership.mem.{u2, u2} β (Set.{u2} β) (Set.instMembershipSet.{u2} β) y s) (r x y))))
-Case conversion may be inaccurate. Consider using '#align rel.preimage_def Rel.preimage_defₓ'. -/
 theorem preimage_def (s : Set β) : preimage r s = { x | ∃ y ∈ s, r x y } :=
   Set.ext fun x => mem_preimage _ _ _
 #align rel.preimage_def Rel.preimage_def
@@ -288,22 +192,10 @@ theorem preimage_mono {s t : Set β} (h : s ⊆ t) : r.Preimage s ⊆ r.Preimage
 #align rel.preimage_mono Rel.preimage_mono
 -/
 
-/- warning: rel.preimage_inter -> Rel.preimage_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Rel.preimage.{u1, u2} α β r (Inter.inter.{u2} (Set.{u2} β) (Set.hasInter.{u2} β) s t)) (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) (Rel.preimage.{u1, u2} α β r s) (Rel.preimage.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Rel.preimage.{u1, u2} α β r (Inter.inter.{u2} (Set.{u2} β) (Set.instInterSet.{u2} β) s t)) (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) (Rel.preimage.{u1, u2} α β r s) (Rel.preimage.{u1, u2} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.preimage_inter Rel.preimage_interₓ'. -/
 theorem preimage_inter (s t : Set β) : r.Preimage (s ∩ t) ⊆ r.Preimage s ∩ r.Preimage t :=
   image_inter _ s t
 #align rel.preimage_inter Rel.preimage_inter
 
-/- warning: rel.preimage_union -> Rel.preimage_union is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α β r (Union.union.{u2} (Set.{u2} β) (Set.hasUnion.{u2} β) s t)) (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) (Rel.preimage.{u1, u2} α β r s) (Rel.preimage.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α β r (Union.union.{u2} (Set.{u2} β) (Set.instUnionSet.{u2} β) s t)) (Union.union.{u1} (Set.{u1} α) (Set.instUnionSet.{u1} α) (Rel.preimage.{u1, u2} α β r s) (Rel.preimage.{u1, u2} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.preimage_union Rel.preimage_unionₓ'. -/
 theorem preimage_union (s t : Set β) : r.Preimage (s ∪ t) = r.Preimage s ∪ r.Preimage t :=
   image_union _ s t
 #align rel.preimage_union Rel.preimage_union
@@ -314,22 +206,10 @@ theorem preimage_id (s : Set α) : preimage (@Eq α) s = s := by
 #align rel.preimage_id Rel.preimage_id
 -/
 
-/- warning: rel.preimage_comp -> Rel.preimage_comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (r : Rel.{u1, u2} α β) (s : Rel.{u2, u3} β γ) (t : Set.{u3} γ), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u3} α γ (Rel.comp.{u1, u2, u3} α β γ r s) t) (Rel.preimage.{u1, u2} α β r (Rel.preimage.{u2, u3} β γ s t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} (r : Rel.{u1, u3} α β) (s : Rel.{u3, u2} β γ) (t : Set.{u2} γ), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α γ (Rel.comp.{u1, u3, u2} α β γ r s) t) (Rel.preimage.{u1, u3} α β r (Rel.preimage.{u3, u2} β γ s t))
-Case conversion may be inaccurate. Consider using '#align rel.preimage_comp Rel.preimage_compₓ'. -/
 theorem preimage_comp (s : Rel β γ) (t : Set γ) : preimage (r ∘ s) t = preimage r (preimage s t) :=
   by simp only [preimage, inv_comp, image_comp]
 #align rel.preimage_comp Rel.preimage_comp
 
-/- warning: rel.preimage_univ -> Rel.preimage_univ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{succ u1} (Set.{u1} α) (Rel.preimage.{u1, u2} α β r (Set.univ.{u2} β)) (Rel.dom.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{succ u2} (Set.{u2} α) (Rel.preimage.{u2, u1} α β r (Set.univ.{u1} β)) (Rel.dom.{u2, u1} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.preimage_univ Rel.preimage_univₓ'. -/
 theorem preimage_univ : r.Preimage Set.univ = r.dom := by rw [preimage, image_univ, codom_inv]
 #align rel.preimage_univ Rel.preimage_univ
 
@@ -352,42 +232,18 @@ theorem core_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.core r.core := fun s t h x
 #align rel.core_subset Rel.core_subset
 -/
 
-/- warning: rel.core_mono -> Rel.core_mono is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Monotone.{u2, u1} (Set.{u2} β) (Set.{u1} α) (PartialOrder.toPreorder.{u2} (Set.{u2} β) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} β) (Lattice.toSemilatticeInf.{u2} (Set.{u2} β) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} β) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} β) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u2} (Set.{u2} β) (Set.booleanAlgebra.{u2} β))))))) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (Lattice.toSemilatticeInf.{u1} (Set.{u1} α) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} α) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))))))) (Rel.core.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Monotone.{u2, u1} (Set.{u2} β) (Set.{u1} α) (PartialOrder.toPreorder.{u2} (Set.{u2} β) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} β) (Lattice.toSemilatticeInf.{u2} (Set.{u2} β) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} β) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} β) (BiheytingAlgebra.toCoheytingAlgebra.{u2} (Set.{u2} β) (BooleanAlgebra.toBiheytingAlgebra.{u2} (Set.{u2} β) (Set.instBooleanAlgebraSet.{u2} β)))))))) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (Lattice.toSemilatticeInf.{u1} (Set.{u1} α) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} α) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} α) (BiheytingAlgebra.toCoheytingAlgebra.{u1} (Set.{u1} α) (BooleanAlgebra.toBiheytingAlgebra.{u1} (Set.{u1} α) (Set.instBooleanAlgebraSet.{u1} α)))))))) (Rel.core.{u1, u2} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.core_mono Rel.core_monoₓ'. -/
 theorem core_mono : Monotone r.core :=
   r.core_subset
 #align rel.core_mono Rel.core_mono
 
-/- warning: rel.core_inter -> Rel.core_inter is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.core.{u1, u2} α β r (Inter.inter.{u2} (Set.{u2} β) (Set.hasInter.{u2} β) s t)) (Inter.inter.{u1} (Set.{u1} α) (Set.hasInter.{u1} α) (Rel.core.{u1, u2} α β r s) (Rel.core.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), Eq.{succ u1} (Set.{u1} α) (Rel.core.{u1, u2} α β r (Inter.inter.{u2} (Set.{u2} β) (Set.instInterSet.{u2} β) s t)) (Inter.inter.{u1} (Set.{u1} α) (Set.instInterSet.{u1} α) (Rel.core.{u1, u2} α β r s) (Rel.core.{u1, u2} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.core_inter Rel.core_interₓ'. -/
 theorem core_inter (s t : Set β) : r.core (s ∩ t) = r.core s ∩ r.core t :=
   Set.ext (by simp [mem_core, imp_and, forall_and])
 #align rel.core_inter Rel.core_inter
 
-/- warning: rel.core_union -> Rel.core_union is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) (Rel.core.{u1, u2} α β r s) (Rel.core.{u1, u2} α β r t)) (Rel.core.{u1, u2} α β r (Union.union.{u2} (Set.{u2} β) (Set.hasUnion.{u2} β) s t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u2} β) (t : Set.{u2} β), HasSubset.Subset.{u1} (Set.{u1} α) (Set.instHasSubsetSet.{u1} α) (Union.union.{u1} (Set.{u1} α) (Set.instUnionSet.{u1} α) (Rel.core.{u1, u2} α β r s) (Rel.core.{u1, u2} α β r t)) (Rel.core.{u1, u2} α β r (Union.union.{u2} (Set.{u2} β) (Set.instUnionSet.{u2} β) s t))
-Case conversion may be inaccurate. Consider using '#align rel.core_union Rel.core_unionₓ'. -/
 theorem core_union (s t : Set β) : r.core s ∪ r.core t ⊆ r.core (s ∪ t) :=
   r.core_mono.le_map_sup s t
 #align rel.core_union Rel.core_union
 
-/- warning: rel.core_univ -> Rel.core_univ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), Eq.{succ u1} (Set.{u1} α) (Rel.core.{u1, u2} α β r (Set.univ.{u2} β)) (Set.univ.{u1} α)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{succ u2} (Set.{u2} α) (Rel.core.{u2, u1} α β r (Set.univ.{u1} β)) (Set.univ.{u2} α)
-Case conversion may be inaccurate. Consider using '#align rel.core_univ Rel.core_univₓ'. -/
 @[simp]
 theorem core_univ : r.core Set.univ = Set.univ :=
   Set.ext (by simp [mem_core])
@@ -398,12 +254,6 @@ theorem core_id (s : Set α) : core (@Eq α) s = s := by simp [core]
 #align rel.core_id Rel.core_id
 -/
 
-/- warning: rel.core_comp -> Rel.core_comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} (r : Rel.{u1, u2} α β) (s : Rel.{u2, u3} β γ) (t : Set.{u3} γ), Eq.{succ u1} (Set.{u1} α) (Rel.core.{u1, u3} α γ (Rel.comp.{u1, u2, u3} α β γ r s) t) (Rel.core.{u1, u2} α β r (Rel.core.{u2, u3} β γ s t))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} (r : Rel.{u1, u3} α β) (s : Rel.{u3, u2} β γ) (t : Set.{u2} γ), Eq.{succ u1} (Set.{u1} α) (Rel.core.{u1, u2} α γ (Rel.comp.{u1, u3, u2} α β γ r s) t) (Rel.core.{u1, u3} α β r (Rel.core.{u3, u2} β γ s t))
-Case conversion may be inaccurate. Consider using '#align rel.core_comp Rel.core_compₓ'. -/
 theorem core_comp (s : Rel β γ) (t : Set γ) : core (r ∘ s) t = core r (core s t) :=
   by
   ext x; simp [core, comp]; constructor
@@ -417,22 +267,10 @@ def restrictDomain (s : Set α) : Rel { x // x ∈ s } β := fun x y => r x.val
 #align rel.restrict_domain Rel.restrictDomain
 -/
 
-/- warning: rel.image_subset_iff -> Rel.image_subset_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β) (s : Set.{u1} α) (t : Set.{u2} β), Iff (HasSubset.Subset.{u2} (Set.{u2} β) (Set.hasSubset.{u2} β) (Rel.image.{u1, u2} α β r s) t) (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) s (Rel.core.{u1, u2} α β r t))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β) (s : Set.{u2} α) (t : Set.{u1} β), Iff (HasSubset.Subset.{u1} (Set.{u1} β) (Set.instHasSubsetSet.{u1} β) (Rel.image.{u2, u1} α β r s) t) (HasSubset.Subset.{u2} (Set.{u2} α) (Set.instHasSubsetSet.{u2} α) s (Rel.core.{u2, u1} α β r t))
-Case conversion may be inaccurate. Consider using '#align rel.image_subset_iff Rel.image_subset_iffₓ'. -/
 theorem image_subset_iff (s : Set α) (t : Set β) : image r s ⊆ t ↔ s ⊆ core r t :=
   Iff.intro (fun h x xs y rxy => h ⟨x, xs, rxy⟩) fun h y ⟨x, xs, rxy⟩ => h xs y rxy
 #align rel.image_subset_iff Rel.image_subset_iff
 
-/- warning: rel.image_core_gc -> Rel.image_core_gc is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : Rel.{u1, u2} α β), GaloisConnection.{u1, u2} (Set.{u1} α) (Set.{u2} β) (PartialOrder.toPreorder.{u1} (Set.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} α) (Lattice.toSemilatticeInf.{u1} (Set.{u1} α) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} α) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} α) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α))))))) (PartialOrder.toPreorder.{u2} (Set.{u2} β) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} β) (Lattice.toSemilatticeInf.{u2} (Set.{u2} β) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} β) (GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} β) (BooleanAlgebra.toGeneralizedBooleanAlgebra.{u2} (Set.{u2} β) (Set.booleanAlgebra.{u2} β))))))) (Rel.image.{u1, u2} α β r) (Rel.core.{u1, u2} α β r)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), GaloisConnection.{u2, u1} (Set.{u2} α) (Set.{u1} β) (PartialOrder.toPreorder.{u2} (Set.{u2} α) (SemilatticeInf.toPartialOrder.{u2} (Set.{u2} α) (Lattice.toSemilatticeInf.{u2} (Set.{u2} α) (GeneralizedCoheytingAlgebra.toLattice.{u2} (Set.{u2} α) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u2} (Set.{u2} α) (BiheytingAlgebra.toCoheytingAlgebra.{u2} (Set.{u2} α) (BooleanAlgebra.toBiheytingAlgebra.{u2} (Set.{u2} α) (Set.instBooleanAlgebraSet.{u2} α)))))))) (PartialOrder.toPreorder.{u1} (Set.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (Set.{u1} β) (Lattice.toSemilatticeInf.{u1} (Set.{u1} β) (GeneralizedCoheytingAlgebra.toLattice.{u1} (Set.{u1} β) (CoheytingAlgebra.toGeneralizedCoheytingAlgebra.{u1} (Set.{u1} β) (BiheytingAlgebra.toCoheytingAlgebra.{u1} (Set.{u1} β) (BooleanAlgebra.toBiheytingAlgebra.{u1} (Set.{u1} β) (Set.instBooleanAlgebraSet.{u1} β)))))))) (Rel.image.{u2, u1} α β r) (Rel.core.{u2, u1} α β r)
-Case conversion may be inaccurate. Consider using '#align rel.image_core_gc Rel.image_core_gcₓ'. -/
 theorem image_core_gc : GaloisConnection r.image r.core :=
   image_subset_iff _
 #align rel.image_core_gc Rel.image_core_gc
@@ -451,12 +289,6 @@ end Function
 
 namespace Set
 
-/- warning: set.image_eq -> Set.image_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (f : α -> β) (s : Set.{u1} α), Eq.{succ u2} (Set.{u2} β) (Set.image.{u1, u2} α β f s) (Rel.image.{u1, u2} α β (Function.graph.{u1, u2} α β f) s)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (f : α -> β) (s : Set.{u2} α), Eq.{succ u1} (Set.{u1} β) (Set.image.{u2, u1} α β f s) (Rel.image.{u2, u1} α β (Function.graph.{u2, u1} α β f) s)
-Case conversion may be inaccurate. Consider using '#align set.image_eq Set.image_eqₓ'. -/
 -- TODO: if image were defined with bounded quantification in corelib, the next two would
 -- be definitional
 theorem image_eq (f : α → β) (s : Set α) : f '' s = (Function.graph f).image s := by
Diff
@@ -74,9 +74,7 @@ lean 3 declaration is
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.inv.{u1, u2} β α (Rel.inv.{u2, u1} α β r)) r
 Case conversion may be inaccurate. Consider using '#align rel.inv_inv Rel.inv_invₓ'. -/
-theorem inv_inv : inv (inv r) = r := by
-  ext (x y)
-  rfl
+theorem inv_inv : inv (inv r) = r := by ext (x y); rfl
 #align rel.inv_inv Rel.inv_inv
 
 #print Rel.dom /-
@@ -108,15 +106,11 @@ lean 3 declaration is
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{succ u2} (Set.{u2} α) (Rel.codom.{u1, u2} β α (Rel.inv.{u2, u1} α β r)) (Rel.dom.{u2, u1} α β r)
 Case conversion may be inaccurate. Consider using '#align rel.codom_inv Rel.codom_invₓ'. -/
-theorem codom_inv : r.inv.codom = r.dom := by
-  ext (x y)
-  rfl
+theorem codom_inv : r.inv.codom = r.dom := by ext (x y); rfl
 #align rel.codom_inv Rel.codom_inv
 
 #print Rel.dom_inv /-
-theorem dom_inv : r.inv.dom = r.codom := by
-  ext (x y)
-  rfl
+theorem dom_inv : r.inv.dom = r.codom := by ext (x y); rfl
 #align rel.dom_inv Rel.dom_inv
 -/
 
@@ -138,8 +132,7 @@ Case conversion may be inaccurate. Consider using '#align rel.comp_assoc Rel.com
 theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : ((r ∘ s) ∘ t) = (r ∘ s ∘ t) :=
   by
   unfold comp; ext (x w); constructor
-  · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩
-    exact ⟨y, rxy, z, syz, tzw⟩
+  · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
   rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
 #align rel.comp_assoc Rel.comp_assoc
 
@@ -150,11 +143,7 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.comp.{u2, u1, u1} α β β r (Eq.{succ u1} β)) r
 Case conversion may be inaccurate. Consider using '#align rel.comp_right_id Rel.comp_right_idₓ'. -/
 @[simp]
-theorem comp_right_id (r : Rel α β) : (r ∘ @Eq β) = r :=
-  by
-  unfold comp
-  ext y
-  simp
+theorem comp_right_id (r : Rel α β) : (r ∘ @Eq β) = r := by unfold comp; ext y; simp
 #align rel.comp_right_id Rel.comp_right_id
 
 /- warning: rel.comp_left_id -> Rel.comp_left_id is a dubious translation:
@@ -164,17 +153,11 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (r : Rel.{u2, u1} α β), Eq.{max (succ u2) (succ u1)} (Rel.{u2, u1} α β) (Rel.comp.{u2, u2, u1} α α β (Eq.{succ u2} α) r) r
 Case conversion may be inaccurate. Consider using '#align rel.comp_left_id Rel.comp_left_idₓ'. -/
 @[simp]
-theorem comp_left_id (r : Rel α β) : (@Eq α ∘ r) = r :=
-  by
-  unfold comp
-  ext x
-  simp
+theorem comp_left_id (r : Rel α β) : (@Eq α ∘ r) = r := by unfold comp; ext x; simp
 #align rel.comp_left_id Rel.comp_left_id
 
 #print Rel.inv_id /-
-theorem inv_id : inv (@Eq α) = @Eq α := by
-  ext (x y)
-  constructor <;> apply Eq.symm
+theorem inv_id : inv (@Eq α) = @Eq α := by ext (x y); constructor <;> apply Eq.symm
 #align rel.inv_id Rel.inv_id
 -/
 
@@ -184,9 +167,7 @@ lean 3 declaration is
 but is expected to have type
   forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} (r : Rel.{u3, u2} α β) (s : Rel.{u2, u1} β γ), Eq.{max (succ u3) (succ u1)} (Rel.{u1, u3} γ α) (Rel.inv.{u3, u1} α γ (Rel.comp.{u3, u2, u1} α β γ r s)) (Rel.comp.{u1, u2, u3} γ β α (Rel.inv.{u2, u1} β γ s) (Rel.inv.{u3, u2} α β r))
 Case conversion may be inaccurate. Consider using '#align rel.inv_comp Rel.inv_compₓ'. -/
-theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) :=
-  by
-  ext (x z)
+theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r ∘ s) = (inv s ∘ inv r) := by ext (x z);
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
 
@@ -252,10 +233,7 @@ theorem image_union (s t : Set α) : r.image (s ∪ t) = r.image s ∪ r.image t
 
 #print Rel.image_id /-
 @[simp]
-theorem image_id (s : Set α) : image (@Eq α) s = s :=
-  by
-  ext x
-  simp [mem_image]
+theorem image_id (s : Set α) : image (@Eq α) s = s := by ext x; simp [mem_image]
 #align rel.image_id Rel.image_id
 -/
 
@@ -268,16 +246,12 @@ Case conversion may be inaccurate. Consider using '#align rel.image_comp Rel.ima
 theorem image_comp (s : Rel β γ) (t : Set α) : image (r ∘ s) t = image s (image r t) :=
   by
   ext z; simp only [mem_image]; constructor
-  · rintro ⟨x, xt, y, rxy, syz⟩
-    exact ⟨y, ⟨x, xt, rxy⟩, syz⟩
+  · rintro ⟨x, xt, y, rxy, syz⟩; exact ⟨y, ⟨x, xt, rxy⟩, syz⟩
   rintro ⟨y, ⟨x, xt, rxy⟩, syz⟩; exact ⟨x, xt, y, rxy, syz⟩
 #align rel.image_comp Rel.image_comp
 
 #print Rel.image_univ /-
-theorem image_univ : r.image Set.univ = r.codom :=
-  by
-  ext y
-  simp [mem_image, codom]
+theorem image_univ : r.image Set.univ = r.codom := by ext y; simp [mem_image, codom]
 #align rel.image_univ Rel.image_univ
 -/
 
Diff
@@ -88,7 +88,7 @@ def dom :=
 
 /- warning: rel.dom_mono -> Rel.dom_mono is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {r : Rel.{u1, u2} α β} {s : Rel.{u1, u2} α β}, (LE.le.{max u1 u2} (Rel.{u1, u2} α β) (Preorder.toLE.{max u1 u2} (Rel.{u1, u2} α β) (PartialOrder.toPreorder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteSemilatticeInf.toPartialOrder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteLattice.toCompleteSemilatticeInf.{max u1 u2} (Rel.{u1, u2} α β) (Rel.completeLattice.{u1, u2} α β))))) r s) -> (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Rel.dom.{u1, u2} α β r) (Rel.dom.{u1, u2} α β s))
+  forall {α : Type.{u1}} {β : Type.{u2}} {r : Rel.{u1, u2} α β} {s : Rel.{u1, u2} α β}, (LE.le.{max u1 u2} (Rel.{u1, u2} α β) (Preorder.toHasLe.{max u1 u2} (Rel.{u1, u2} α β) (PartialOrder.toPreorder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteSemilatticeInf.toPartialOrder.{max u1 u2} (Rel.{u1, u2} α β) (CompleteLattice.toCompleteSemilatticeInf.{max u1 u2} (Rel.{u1, u2} α β) (Rel.completeLattice.{u1, u2} α β))))) r s) -> (HasSubset.Subset.{u1} (Set.{u1} α) (Set.hasSubset.{u1} α) (Rel.dom.{u1, u2} α β r) (Rel.dom.{u1, u2} α β s))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} {r : Rel.{u2, u1} α β} {s : Rel.{u2, u1} α β}, (LE.le.{max u2 u1} (Rel.{u2, u1} α β) (Preorder.toLE.{max u2 u1} (Rel.{u2, u1} α β) (PartialOrder.toPreorder.{max u2 u1} (Rel.{u2, u1} α β) (CompleteSemilatticeInf.toPartialOrder.{max u2 u1} (Rel.{u2, u1} α β) (CompleteLattice.toCompleteSemilatticeInf.{max u2 u1} (Rel.{u2, u1} α β) (instCompleteLatticeRel.{u2, u1} α β))))) r s) -> (HasSubset.Subset.{u2} (Set.{u2} α) (Set.instHasSubsetSet.{u2} α) (Rel.dom.{u2, u1} α β r) (Rel.dom.{u2, u1} α β s))
 Case conversion may be inaccurate. Consider using '#align rel.dom_mono Rel.dom_monoₓ'. -/

Changes in mathlib4

mathlib3
mathlib4
feat(CategoryTheory/Category/RelCat): Show basic facts and self-duality of category of relations. (#11241)

Add facts about rel somewhat like the facts about types, classify isos in rel, construct the inclusion from types to rel, show self-duality of rel.

Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com> Co-authored-by: uni <uniwuni@protonmail.com> Co-authored-by: uni marx <uniwuni@protonmail.com>

Diff
@@ -367,6 +367,15 @@ def graph (f : α → β) : Rel α β := fun x y => f x = y
 
 @[simp] lemma graph_def (f : α → β) (x y) : f.graph x y ↔ (f x = y) := Iff.rfl
 
+theorem graph_injective : Injective (graph : (α → β) → Rel α β) := by
+  intro _ g h
+  ext x
+  have h2 := congr_fun₂ h x (g x)
+  simp only [graph_def, eq_iff_iff, iff_true] at h2
+  exact h2
+
+@[simp] lemma graph_inj {f g : α → β} : f.graph = g.graph ↔ f = g := graph_injective.eq_iff
+
 theorem graph_id : graph id = @Eq α := by simp  (config := { unfoldPartialApp := true }) [graph]
 
 theorem graph_comp {f : β → γ} {g : α → β} : graph (f ∘ g) = Rel.comp (graph g) (graph f) := by
chore: remove autoImplicit from more files (#11798)

and reduce its scope in a few other instances. Mostly in CategoryTheory and Data this time; some Combinatorics also.

Co-authored-by: Richard Osborn <richardosborn@mac.com>

Diff
@@ -32,9 +32,6 @@ Relations are also known as set-valued functions, or partial multifunctions.
 * `Function.graph`: Graph of a function as a relation.
 -/
 
-set_option autoImplicit true
-
-
 variable {α β γ : Type*}
 
 /-- A relation on `α` and `β`, aka a set-valued function, aka a partial multifunction -/
@@ -97,7 +94,8 @@ def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y
 /-- Local syntax for composition of relations. -/
 local infixr:90 " • " => Rel.comp
 
-theorem comp_assoc (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) : (r • s) • t = r • (s • t) := by
+theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) :
+    (r • s) • t = r • (s • t) := by
   unfold comp; ext (x w); constructor
   · rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
   · rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
chore: work around simp issues in future nightlies (#11546)
Diff
@@ -149,11 +149,15 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv
 
 @[simp]
 theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by
-  simp [Bot.bot, inv, flip]
+  -- Adaptation note: nightly-2024-03-16: simp was
+  -- simp [Bot.bot, inv, flip]
+  simp [Bot.bot, inv, Function.flip_def]
 
 @[simp]
 theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) := by
-  simp [Top.top, inv, flip]
+  -- Adaptation note: nightly-2024-03-16: simp was
+  -- simp [Top.top, inv, flip]
+  simp [Top.top, inv, Function.flip_def]
 
 /-- Image of a set under a relation -/
 def image (s : Set α) : Set β := { y | ∃ x ∈ s, r x y }
chore: replace λ by fun (#11301)

Per the style guidelines, λ is disallowed in mathlib. This is close to exhaustive; I left some tactic code alone when it seemed to me that tactic could be upstreamed soon.

Notes

  • In lines I was modifying anyway, I also converted => to .
  • Also contains some mild in-passing indentation fixes in Mathlib/Order/SupClosed.
  • Some doc comments still contained Lean 3 syntax λ x, , which I also replaced.
Diff
@@ -128,12 +128,12 @@ theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥ := by
   simp [comp, Bot.bot]
 
 @[simp]
-theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = λ x _ ↦ x ∈ r.dom := by
+theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = fun x _ ↦ x ∈ r.dom := by
   ext x z
   simp [comp, Top.top, dom]
 
 @[simp]
-theorem comp_left_top (r : Rel α β) : (⊤ : Rel γ α) • r = λ _ y ↦ y ∈ r.codom := by
+theorem comp_left_top (r : Rel α β) : (⊤ : Rel γ α) • r = fun _ y ↦ y ∈ r.codom := by
   ext x z
   simp [comp, Top.top, codom]
 
@@ -213,7 +213,7 @@ theorem image_bot (s : Set α) : (⊥ : Rel α β).image s = ∅ := by
 @[simp]
 theorem image_top {s : Set α} (h : Set.Nonempty s) :
     (⊤ : Rel α β).image s = Set.univ :=
-  Set.eq_univ_of_forall λ x ↦ ⟨h.some, by simp [h.some_mem, Top.top]⟩
+  Set.eq_univ_of_forall fun x ↦ ⟨h.some, by simp [h.some_mem, Top.top]⟩
 
 /-- Preimage of a set under a relation `r`. Same as the image of `s` under `r.inv` -/
 def preimage (s : Set β) : Set α :=
chore: more squeeze_simps arising from linter (#11259)

The squeezing continues! All found by the linter at #11246.

Diff
@@ -338,7 +338,7 @@ theorem core_id (s : Set α) : core (@Eq α) s = s := by simp [core]
 #align rel.core_id Rel.core_id
 
 theorem core_comp (s : Rel β γ) (t : Set γ) : core (r • s) t = core r (core s t) := by
-  ext x; simp [core, comp]; constructor
+  ext x; simp only [core, comp, forall_exists_index, and_imp, Set.mem_setOf_eq]; constructor
   · exact fun h y rxy z => h z y rxy
   · exact fun h z y rzy => h y rzy z
 #align rel.core_comp Rel.core_comp
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -5,7 +5,7 @@ Authors: Jeremy Avigad
 -/
 import Mathlib.Order.CompleteLattice
 import Mathlib.Order.GaloisConnection
-import Mathlib.Order.Hom.CompleteLattice
+import Mathlib.Data.Set.Lattice
 
 #align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
 
chore: tidy various files (#8818)
Diff
@@ -291,7 +291,7 @@ theorem image_inter_dom_eq (s : Set α) : r.image (s ∩ r.dom) = r.image s := b
 
 @[simp]
 theorem preimage_inter_codom_eq (s : Set β) : r.preimage (s ∩ r.codom) = r.preimage s := by
-  rw[← dom_inv, preimage, preimage, image_inter_dom_eq]
+  rw [← dom_inv, preimage, preimage, image_inter_dom_eq]
 
 theorem inter_dom_subset_preimage_image (s : Set α) : s ∩ r.dom ⊆ r.preimage (r.image s) := by
   intro x hx
@@ -384,7 +384,7 @@ theorem Relation.is_graph_iff (r : Rel α β) : (∃! f, Function.graph f = r) 
     use f x
     simp only [forall_eq', and_self]
   · intro h
-    rcases Classical.axiomOfChoice (λ x ↦ (h x).exists) with ⟨f,hf⟩
+    choose f hf using fun x ↦ (h x).exists
     use f
     constructor
     · ext x _
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -291,7 +291,7 @@ theorem image_inter_dom_eq (s : Set α) : r.image (s ∩ r.dom) = r.image s := b
 
 @[simp]
 theorem preimage_inter_codom_eq (s : Set β) : r.preimage (s ∩ r.codom) = r.preimage s := by
-  rw[←dom_inv, preimage, preimage, image_inter_dom_eq]
+  rw[← dom_inv, preimage, preimage, image_inter_dom_eq]
 
 theorem inter_dom_subset_preimage_image (s : Set α) : s ∩ r.dom ⊆ r.preimage (r.image s) := by
   intro x hx
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -148,10 +148,12 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv
 #align rel.inv_comp Rel.inv_comp
 
 @[simp]
-theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by simp [Bot.bot, inv, flip]
+theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by
+  simp [Bot.bot, inv, flip]
 
 @[simp]
-theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) := by simp [Top.top, inv, flip]
+theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) := by
+  simp [Top.top, inv, flip]
 
 /-- Image of a set under a relation -/
 def image (s : Set α) : Set β := { y | ∃ x ∈ s, r x y }
@@ -363,7 +365,7 @@ def graph (f : α → β) : Rel α β := fun x y => f x = y
 
 @[simp] lemma graph_def (f : α → β) (x y) : f.graph x y ↔ (f x = y) := Iff.rfl
 
-theorem graph_id : graph id = @Eq α := by simp [graph]
+theorem graph_id : graph id = @Eq α := by simp  (config := { unfoldPartialApp := true }) [graph]
 
 theorem graph_comp {f : β → γ} {g : α → β} : graph (f ∘ g) = Rel.comp (graph g) (graph f) := by
   ext x y
feat(Data/Rel): prove simple propositions about images, preimages and graphs of relations (#6559)

Add lemmas about relation composition with top and bottom elements, conditions under which images under a relation form the whole codomain, and the equivalence between being a functional relation and representable by the graph of a function.

Co-authored-by: uniwuni <95649083+uniwuni@users.noreply.github.com>

Diff
@@ -5,6 +5,7 @@ Authors: Jeremy Avigad
 -/
 import Mathlib.Order.CompleteLattice
 import Mathlib.Order.GaloisConnection
+import Mathlib.Order.Hom.CompleteLattice
 
 #align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
 
@@ -116,6 +117,26 @@ theorem comp_left_id (r : Rel α β) : @Eq α • r = r := by
   simp
 #align rel.comp_left_id Rel.comp_left_id
 
+@[simp]
+theorem comp_right_bot (r : Rel α β) : r • (⊥ : Rel β γ) = ⊥ := by
+  ext x y
+  simp [comp, Bot.bot]
+
+@[simp]
+theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥ := by
+  ext x y
+  simp [comp, Bot.bot]
+
+@[simp]
+theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = λ x _ ↦ x ∈ r.dom := by
+  ext x z
+  simp [comp, Top.top, dom]
+
+@[simp]
+theorem comp_left_top (r : Rel α β) : (⊤ : Rel γ α) • r = λ _ y ↦ y ∈ r.codom := by
+  ext x z
+  simp [comp, Top.top, codom]
+
 theorem inv_id : inv (@Eq α) = @Eq α := by
   ext x y
   constructor <;> apply Eq.symm
@@ -126,6 +147,12 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
 
+@[simp]
+theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by simp [Bot.bot, inv, flip]
+
+@[simp]
+theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) := by simp [Top.top, inv, flip]
+
 /-- Image of a set under a relation -/
 def image (s : Set α) : Set β := { y | ∃ x ∈ s, r x y }
 #align rel.image Rel.image
@@ -170,6 +197,22 @@ theorem image_univ : r.image Set.univ = r.codom := by
   simp [mem_image, codom]
 #align rel.image_univ Rel.image_univ
 
+@[simp]
+theorem image_empty : r.image ∅ = ∅ := by
+  ext x
+  simp [mem_image]
+
+@[simp]
+theorem image_bot (s : Set α) : (⊥ : Rel α β).image s = ∅ := by
+  rw [Set.eq_empty_iff_forall_not_mem]
+  intro x h
+  simp [mem_image, Bot.bot] at h
+
+@[simp]
+theorem image_top {s : Set α} (h : Set.Nonempty s) :
+    (⊤ : Rel α β).image s = Set.univ :=
+  Set.eq_univ_of_forall λ x ↦ ⟨h.some, by simp [h.some_mem, Top.top]⟩
+
 /-- Preimage of a set under a relation `r`. Same as the image of `s` under `r.inv` -/
 def preimage (s : Set β) : Set α :=
   r.inv.image s
@@ -206,6 +249,60 @@ theorem preimage_comp (s : Rel β γ) (t : Set γ) : preimage (r • s) t = prei
 theorem preimage_univ : r.preimage Set.univ = r.dom := by rw [preimage, image_univ, codom_inv]
 #align rel.preimage_univ Rel.preimage_univ
 
+@[simp]
+theorem preimage_empty : r.preimage ∅ = ∅ := by rw [preimage, image_empty]
+
+@[simp]
+theorem preimage_inv (s : Set α) : r.inv.preimage s = r.image s := by rw [preimage, inv_inv]
+
+@[simp]
+theorem preimage_bot (s : Set β) : (⊥ : Rel α β).preimage s = ∅ :=
+  by rw [preimage, inv_bot, image_bot]
+
+@[simp]
+theorem preimage_top {s : Set β} (h : Set.Nonempty s) :
+    (⊤ : Rel α β).preimage s = Set.univ := by rwa [← inv_top, preimage, inv_inv, image_top]
+
+theorem image_eq_dom_of_codomain_subset {s : Set β} (h : r.codom ⊆ s) : r.preimage s = r.dom := by
+  rw [← preimage_univ]
+  apply Set.eq_of_subset_of_subset
+  · exact image_subset _ (Set.subset_univ _)
+  · intro x hx
+    simp only [mem_preimage, Set.mem_univ, true_and] at hx
+    rcases hx with ⟨y, ryx⟩
+    have hy : y ∈ s := h ⟨x, ryx⟩
+    exact ⟨y, ⟨hy, ryx⟩⟩
+
+theorem preimage_eq_codom_of_domain_subset {s : Set α} (h : r.dom ⊆ s) : r.image s = r.codom :=
+  by apply r.inv.image_eq_dom_of_codomain_subset (by rwa [← codom_inv] at h)
+
+theorem image_inter_dom_eq (s : Set α) : r.image (s ∩ r.dom) = r.image s := by
+  apply Set.eq_of_subset_of_subset
+  · apply r.image_mono (by simp)
+  · intro x h
+    rw [mem_image] at *
+    rcases h with ⟨y, hy, ryx⟩
+    use y
+    suffices h : y ∈ r.dom by simp_all only [Set.mem_inter_iff, and_self]
+    rw [dom, Set.mem_setOf_eq]
+    use x
+
+@[simp]
+theorem preimage_inter_codom_eq (s : Set β) : r.preimage (s ∩ r.codom) = r.preimage s := by
+  rw[←dom_inv, preimage, preimage, image_inter_dom_eq]
+
+theorem inter_dom_subset_preimage_image (s : Set α) : s ∩ r.dom ⊆ r.preimage (r.image s) := by
+  intro x hx
+  simp only [Set.mem_inter_iff, dom] at hx
+  rcases hx with ⟨hx, ⟨y, rxy⟩⟩
+  use y
+  simp only [image, Set.mem_setOf_eq]
+  exact ⟨⟨x, hx, rxy⟩, rxy⟩
+
+theorem image_preimage_subset_inter_codom (s : Set β) : s ∩ r.codom ⊆ r.image (r.preimage s) := by
+  rw [← dom_inv, ← preimage_inv]
+  apply inter_dom_subset_preimage_image
+
 /-- 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 β) := { x | ∀ y, r x y → y ∈ s }
@@ -264,22 +361,52 @@ namespace Function
 def graph (f : α → β) : Rel α β := fun x y => f x = y
 #align function.graph Function.graph
 
+@[simp] lemma graph_def (f : α → β) (x y) : f.graph x y ↔ (f x = y) := Iff.rfl
+
+theorem graph_id : graph id = @Eq α := by simp [graph]
+
+theorem graph_comp {f : β → γ} {g : α → β} : graph (f ∘ g) = Rel.comp (graph g) (graph f) := by
+  ext x y
+  simp [Rel.comp]
+
 end Function
 
+theorem Equiv.graph_inv (f : α ≃ β) : (f.symm : β → α).graph = Rel.inv (f : α → β).graph := by
+  ext x y
+  aesop (add norm Rel.inv_def)
+
+theorem Relation.is_graph_iff (r : Rel α β) : (∃! f, Function.graph f = r) ↔ ∀ x, ∃! y, r x y := by
+  unfold Function.graph
+  constructor
+  · rintro ⟨f, rfl, _⟩ x
+    use f x
+    simp only [forall_eq', and_self]
+  · intro h
+    rcases Classical.axiomOfChoice (λ x ↦ (h x).exists) with ⟨f,hf⟩
+    use f
+    constructor
+    · ext x _
+      constructor
+      · rintro rfl
+        exact hf x
+      · exact (h x).unique (hf x)
+    · rintro _ rfl
+      exact funext hf
+
 namespace Set
 
 -- TODO: if image were defined with bounded quantification in corelib, the next two would
 -- be definitional
 theorem image_eq (f : α → β) (s : Set α) : f '' s = (Function.graph f).image s := by
-  simp [Set.image, Function.graph, Rel.image]
+  simp [Set.image, Rel.image]
 #align set.image_eq Set.image_eq
 
 theorem preimage_eq (f : α → β) (s : Set β) : f ⁻¹' s = (Function.graph f).preimage s := by
-  simp [Set.preimage, Function.graph, Rel.preimage, Rel.inv, flip, Rel.image]
+  simp [Set.preimage, Rel.preimage, Rel.inv, flip, Rel.image]
 #align set.preimage_eq Set.preimage_eq
 
 theorem preimage_eq_core (f : α → β) (s : Set β) : f ⁻¹' s = (Function.graph f).core s := by
-  simp [Set.preimage, Function.graph, Rel.core]
+  simp [Set.preimage, Rel.core]
 #align set.preimage_eq_core Set.preimage_eq_core
 
 end Set
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -31,6 +31,8 @@ Relations are also known as set-valued functions, or partial multifunctions.
 * `Function.graph`: Graph of a function as a relation.
 -/
 
+set_option autoImplicit true
+
 
 variable {α β γ : Type*}
 
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -32,10 +32,10 @@ Relations are also known as set-valued functions, or partial multifunctions.
 -/
 
 
-variable {α β γ : Type _}
+variable {α β γ : Type*}
 
 /-- A relation on `α` and `β`, aka a set-valued function, aka a partial multifunction -/
-def Rel (α β : Type _) :=
+def Rel (α β : Type*) :=
   α → β → Prop -- deriving CompleteLattice, Inhabited
 #align rel Rel
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2018 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.rel
-! leanprover-community/mathlib commit 706d88f2b8fdfeb0b22796433d7a6c1a010af9f2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Order.CompleteLattice
 import Mathlib.Order.GaloisConnection
 
+#align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
+
 /-!
 # Relations
 
chore: remove superfluous parentheses in calls to ext (#5258)

Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Pol'tta / Miyahara Kō <pol_tta@outlook.jp> Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com> Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -63,7 +63,7 @@ theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
 #align rel.inv_def Rel.inv_def
 
 theorem inv_inv : inv (inv r) = r := by
-  ext (x y)
+  ext x y
   rfl
 #align rel.inv_inv Rel.inv_inv
 
@@ -118,12 +118,12 @@ theorem comp_left_id (r : Rel α β) : @Eq α • r = r := by
 #align rel.comp_left_id Rel.comp_left_id
 
 theorem inv_id : inv (@Eq α) = @Eq α := by
-  ext (x y)
+  ext x y
   constructor <;> apply Eq.symm
 #align rel.inv_id Rel.inv_id
 
 theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv r := by
-  ext (x z)
+  ext x z
   simp [comp, inv, flip, and_comm]
 #align rel.inv_comp Rel.inv_comp
 
chore: bump to nightly-2023-05-31 (#4530)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Alex J Best <alex.j.best@gmail.com>

Diff
@@ -79,12 +79,12 @@ def codom := { y | ∃ x, r x y }
 #align rel.codom Rel.codom
 
 theorem codom_inv : r.inv.codom = r.dom := by
-  ext (x y)
+  ext x
   rfl
 #align rel.codom_inv Rel.codom_inv
 
 theorem dom_inv : r.inv.dom = r.codom := by
-  ext (x y)
+  ext x
   rfl
 #align rel.dom_inv Rel.dom_inv
 
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -20,7 +20,7 @@ Relations are also known as set-valued functions, or partial multifunctions.
 ## Main declarations
 
 * `Rel α β`: Relation between `α` and `β`.
-* `Rel.inv`: `r.inv` is the `rel β α` obtained by swapping the arguments of `r`.
+* `Rel.inv`: `r.inv` is the `Rel β α` obtained by swapping the arguments of `r`.
 * `Rel.dom`: Domain of a relation. `x ∈ r.dom` iff there exists `y` such that `r x y`.
 * `Rel.codom`: Codomain, aka range, of a relation. `y ∈ r.codom` iff there exists `x` such that
   `r x y`.
chore: tidy various files (#1311)
Diff
@@ -68,16 +68,14 @@ theorem inv_inv : inv (inv r) = r := by
 #align rel.inv_inv Rel.inv_inv
 
 /-- Domain of a relation -/
-def dom :=
-  { x | ∃ y, r x y }
+def dom := { x | ∃ y, r x y }
 #align rel.dom Rel.dom
 
 theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩
 #align rel.dom_mono Rel.dom_mono
 
 /-- Codomain aka range of a relation -/
-def codom :=
-  { y | ∃ x, r x y }
+def codom := { y | ∃ x, r x y }
 #align rel.codom Rel.codom
 
 theorem codom_inv : r.inv.codom = r.dom := by
@@ -130,15 +128,14 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv
 #align rel.inv_comp Rel.inv_comp
 
 /-- Image of a set under a relation -/
-def image (s : Set α) : Set β :=
-  { y | ∃ x ∈ s, r x y }
+def image (s : Set α) : Set β := { y | ∃ x ∈ s, r x y }
 #align rel.image Rel.image
 
 theorem mem_image (y : β) (s : Set α) : y ∈ image r s ↔ ∃ x ∈ s, r x y :=
   Iff.rfl
 #align rel.mem_image Rel.mem_image
 
-theorem image_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.image r.image := fun _s _t h _y ⟨x, xs, rxy⟩ =>
+theorem image_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.image r.image := fun _ _ h _ ⟨x, xs, rxy⟩ =>
   ⟨x, h xs, rxy⟩
 #align rel.image_subset Rel.image_subset
 
@@ -212,8 +209,7 @@ theorem preimage_univ : r.preimage Set.univ = r.dom := by rw [preimage, image_un
 
 /-- 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 β) :=
-  { x | ∀ y, r x y → y ∈ s }
+def core (s : Set β) := { x | ∀ y, r x y → y ∈ s }
 #align rel.core Rel.core
 
 theorem mem_core (x : α) (s : Set β) : x ∈ r.core s ↔ ∀ y, r x y → y ∈ s :=
chore: fix casing per naming scheme (#1183)

Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2, add_monoid_hom --> AddMonoidHom

Remove \n from to_additive docstrings that were inserted by mathport.

Move files and directories with Gcd and Smul to GCD and SMul

Diff
@@ -24,11 +24,11 @@ Relations are also known as set-valued functions, or partial multifunctions.
 * `Rel.dom`: Domain of a relation. `x ∈ r.dom` iff there exists `y` such that `r x y`.
 * `Rel.codom`: Codomain, aka range, of a relation. `y ∈ r.codom` iff there exists `x` such that
   `r x y`.
-* `Rel.comp`: Relation composition. Note that the arguments order follows the `category_theory/`
+* `Rel.comp`: Relation composition. Note that the arguments order follows the `CategoryTheory/`
   one, so `r.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 of `f x` over all `x ∈ s`.
 * `Rel.preimage`: Preimage of a set under a relation. Note that `r.preimage = r.inv.image`.
-* `Rel.core`: Core of a set. For `s : set β`, `r.core s` is the set of `x : α` such that all `y`
+* `Rel.core`: Core of a set. For `s : Set β`, `r.core s` is the set of `x : α` such that all `y`
   related to `x` are in `s`.
 * `Rel.restrict_domain`: Domain-restriction of a relation to a subtype.
 * `Function.graph`: Graph of a function as a relation.
@@ -210,8 +210,8 @@ theorem preimage_comp (s : Rel β γ) (t : Set γ) : preimage (r • s) t = prei
 theorem preimage_univ : r.preimage Set.univ = r.dom := by rw [preimage, image_univ, codom_inv]
 #align rel.preimage_univ Rel.preimage_univ
 
-/-- 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`. -/
+/-- 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 β) :=
   { x | ∀ y, r x y → y ∈ s }
 #align rel.core Rel.core
feat: port Data.Rel (#1134)

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Dependencies 57

58 files ported (100.0%)
31767 lines ported (100.0%)

All dependencies are ported!