Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - chore(Data/Quot): [s : Setoid α] => {s : Setoid α} #16256

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mathlib/CategoryTheory/Skeletal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ variable (C D)
/-- Construct the skeleton category as the induced category on the isomorphism classes, and derive
its category structure.
-/
def Skeleton : Type u₁ := InducedCategory C Quotient.out
def Skeleton : Type u₁ := InducedCategory (C := Quotient (isIsomorphicSetoid C)) C Quotient.out

instance [Inhabited C] : Inhabited (Skeleton C) :=
⟨⟦default⟧⟩
Expand Down
42 changes: 21 additions & 21 deletions Mathlib/Data/Quot.lean
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ end Quot

namespace Quotient

variable [sa : Setoid α] [sb : Setoid β]
variable {sa : Setoid α} {sb : Setoid β}
variable {φ : Quotient sa → Quotient sb → Sort*}

-- Porting note: in mathlib3 this notation took the Setoid as an instance-implicit argument,
Expand Down Expand Up @@ -238,7 +238,7 @@ theorem map_mk (f : α → β) (h : ((· ≈ ·) ⇒ (· ≈ ·)) f f) (x : α)
Quotient.map f h (⟦x⟧ : Quotient sa) = (⟦f x⟧ : Quotient sb) :=
rfl

variable {γ : Sort*} [sc : Setoid γ]
variable {γ : Sort*} {sc : Setoid γ}

/-- Map a function `f : α → β → γ` that sends equivalent elements to equivalent elements
to a function `f : Quotient sa → Quotient sb → Quotient sc`.
Expand Down Expand Up @@ -279,7 +279,7 @@ theorem Quot.eq {α : Type*} {r : α → α → Prop} {x y : α} :
⟨Quot.eqvGen_exact, Quot.eqvGen_sound⟩

@[simp]
theorem Quotient.eq [r : Setoid α] {x y : α} : Quotient.mk r x = ⟦y⟧ ↔ x ≈ y :=
theorem Quotient.eq {r : Setoid α} {x y : α} : Quotient.mk r x = ⟦y⟧ ↔ x ≈ y :=
⟨Quotient.exact, Quotient.sound⟩

theorem Quotient.forall {α : Sort*} {s : Setoid α} {p : Quotient s → Prop} :
Expand All @@ -291,29 +291,29 @@ theorem Quotient.exists {α : Sort*} {s : Setoid α} {p : Quotient s → Prop} :
⟨fun ⟨q, hq⟩ ↦ q.ind (motive := (p · → _)) .intro hq, fun ⟨a, ha⟩ ↦ ⟨⟦a⟧, ha⟩⟩

@[simp]
theorem Quotient.lift_mk [s : Setoid α] (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) (x : α) :
theorem Quotient.lift_mk {s : Setoid α} (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) (x : α) :
Quotient.lift f h (Quotient.mk s x) = f x :=
rfl

@[simp]
theorem Quotient.lift_comp_mk [Setoid α] (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) :
theorem Quotient.lift_comp_mk {_ : Setoid α} (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) :
Quotient.lift f h ∘ Quotient.mk _ = f :=
rfl

@[simp]
theorem Quotient.lift₂_mk {α : Sort*} {β : Sort*} {γ : Sort*} [Setoid α] [Setoid β]
theorem Quotient.lift₂_mk {α : Sort*} {β : Sort*} {γ : Sort*} {_ : Setoid α} {_ : Setoid β}
(f : α → β → γ)
(h : ∀ (a₁ : α) (a₂ : β) (b₁ : α) (b₂ : β), a₁ ≈ b₁ → a₂ ≈ b₂ → f a₁ a₂ = f b₁ b₂)
(a : α) (b : β) :
Quotient.lift₂ f h (Quotient.mk _ a) (Quotient.mk _ b) = f a b :=
rfl

theorem Quotient.liftOn_mk [s : Setoid α] (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) (x : α) :
theorem Quotient.liftOn_mk {s : Setoid α} (f : α → β) (h : ∀ a b : α, a ≈ b → f a = f b) (x : α) :
Quotient.liftOn (Quotient.mk s x) f h = f x :=
rfl

@[simp]
theorem Quotient.liftOn₂_mk {α : Sort*} {β : Sort*} [Setoid α] (f : α → α → β)
theorem Quotient.liftOn₂_mk {α : Sort*} {β : Sort*} {_ : Setoid α} (f : α → α → β)
(h : ∀ a₁ a₂ b₁ b₂ : α, a₁ ≈ b₁ → a₂ ≈ b₂ → f a₁ a₂ = f b₁ b₂) (x y : α) :
Quotient.liftOn₂ (Quotient.mk _ x) (Quotient.mk _ y) f h = f x y :=
rfl
Expand Down Expand Up @@ -348,22 +348,22 @@ theorem Quot.out_eq {r : α → α → Prop} (q : Quot r) : Quot.mk r q.out = q

/-- Choose an element of the equivalence class using the axiom of choice.
Sound but noncomputable. -/
noncomputable def Quotient.out [s : Setoid α] : Quotient s → α :=
noncomputable def Quotient.out {s : Setoid α} : Quotient s → α :=
Quot.out

@[simp]
theorem Quotient.out_eq [s : Setoid α] (q : Quotient s) : ⟦q.out⟧ = q :=
theorem Quotient.out_eq {s : Setoid α} (q : Quotient s) : ⟦q.out⟧ = q :=
Quot.out_eq q

theorem Quotient.mk_out [Setoid α] (a : α) : ⟦a⟧.out ≈ a :=
theorem Quotient.mk_out {s : Setoid α} (a : α) : (⟦a⟧ : Quotient s).out ≈ a :=
Quotient.exact (Quotient.out_eq _)

theorem Quotient.mk_eq_iff_out [s : Setoid α] {x : α} {y : Quotient s} :
theorem Quotient.mk_eq_iff_out {s : Setoid α} {x : α} {y : Quotient s} :
⟦x⟧ = y ↔ x ≈ Quotient.out y := by
refine Iff.trans ?_ Quotient.eq
rw [Quotient.out_eq y]

theorem Quotient.eq_mk_iff_out [s : Setoid α] {x : Quotient s} {y : α} :
theorem Quotient.eq_mk_iff_out {s : Setoid α} {x : Quotient s} {y : α} :
x = ⟦y⟧ ↔ Quotient.out x ≈ y := by
refine Iff.trans ?_ Quotient.eq
rw [Quotient.out_eq x]
Expand All @@ -389,18 +389,18 @@ instance piSetoid {ι : Sort*} {α : ι → Sort*} [∀ i, Setoid (α i)] : Seto

/-- Given a function `f : Π i, Quotient (S i)`, returns the class of functions `Π i, α i` sending
each `i` to an element of the class `f i`. -/
noncomputable def Quotient.choice {ι : Type*} {α : ι → Type*} [S : ∀ i, Setoid (α i)]
noncomputable def Quotient.choice {ι : Type*} {α : ι → Type*} {S : ∀ i, Setoid (α i)}
(f : ∀ i, Quotient (S i)) :
@Quotient (∀ i, α i) (by infer_instance) :=
⟦fun i ↦ (f i).out⟧

@[simp]
theorem Quotient.choice_eq {ι : Type*} {α : ι → Type*} [∀ i, Setoid (α i)] (f : ∀ i, α i) :
(Quotient.choice fun i ↦ ⟦f i⟧) = ⟦f⟧ :=
theorem Quotient.choice_eq {ι : Type*} {α : ι → Type*} {S : ∀ i, Setoid (α i)} (f : ∀ i, α i) :
(Quotient.choice (S := S) fun i ↦ ⟦f i⟧) = ⟦f⟧ :=
Quotient.sound fun _ ↦ Quotient.mk_out _

@[elab_as_elim]
theorem Quotient.induction_on_pi {ι : Type*} {α : ι → Sort*} [s : ∀ i, Setoid (α i)]
theorem Quotient.induction_on_pi {ι : Type*} {α : ι → Sort*} {s : ∀ i, Setoid (α i)}
{p : (∀ i, Quotient (s i)) → Prop} (f : ∀ i, Quotient (s i))
(h : ∀ a : ∀ i, α i, p fun i ↦ ⟦a i⟧) : p f := by
rw [← (funext fun i ↦ Quotient.out_eq (f i) : (fun i ↦ ⟦(f i).out⟧) = f)]
Expand Down Expand Up @@ -699,7 +699,7 @@ theorem sound' {a b : α} : @Setoid.r _ s₁ a b → @Quotient.mk'' α s₁ a =
Quotient.sound

@[simp]
protected theorem eq' [s₁ : Setoid α] {a b : α} :
protected theorem eq' {s₁ : Setoid α} {a b : α} :
@Quotient.mk' α s₁ a = @Quotient.mk' α s₁ b ↔ @Setoid.r _ s₁ a b :=
Quotient.eq

Expand All @@ -721,7 +721,7 @@ theorem mk_out' (a : α) : @Setoid.r α s₁ (Quotient.mk'' a : Quotient s₁).o

section

variable [s : Setoid α]
variable {s : Setoid α}

protected theorem mk''_eq_mk : Quotient.mk'' = Quotient.mk s :=
rfl
Expand All @@ -731,12 +731,12 @@ protected theorem liftOn'_mk (x : α) (f : α → β) (h) : (Quotient.mk s x).li
rfl

@[simp]
protected theorem liftOn₂'_mk [t : Setoid β] (f : α → β → γ) (h) (a : α) (b : β) :
protected theorem liftOn₂'_mk {t : Setoid β} (f : α → β → γ) (h) (a : α) (b : β) :
Quotient.liftOn₂' (Quotient.mk s a) (Quotient.mk t b) f h = f a b :=
Quotient.liftOn₂'_mk'' _ _ _ _

@[simp]
theorem map'_mk [t : Setoid β] (f : α → β) (h) (x : α) :
theorem map'_mk {t : Setoid β} (f : α → β) (h) (x : α) :
(Quotient.mk s x).map' f h = (Quotient.mk t (f x)) :=
rfl

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Setoid/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def ker (f : α → β) : Setoid α :=
theorem ker_mk_eq (r : Setoid α) : ker (@Quotient.mk'' _ r) = r :=
ext' fun _ _ => Quotient.eq

theorem ker_apply_mk_out {f : α → β} (a : α) : f (haveI := Setoid.ker f; ⟦a⟧.out) = f a :=
theorem ker_apply_mk_out {f : α → β} (a : α) : f (⟦a⟧ : Quotient (Setoid.ker f)).out = f a :=
@Quotient.mk_out _ (Setoid.ker f) a

theorem ker_apply_mk_out' {f : α → β} (a : α) :
Expand Down
Loading