Zulip Chat Archive

Stream: lean4

Topic: Can we fix Setoid and Quotient?


François G. Dorais (Oct 26 2024 at 03:11):

There are a lot of problems with these, mostly due to what is now archaic design (which made sense at the time!). I would like to collect those problems and potential solutions here so that we can propose a general solution that would work for Lean core, with a hopefully small enough amount of effort on their end.

François G. Dorais (Oct 26 2024 at 03:15):

To get started:

  • I don't think Setoid needs to be a class.
  • It should extend Equivalence so that refl, symm and trans fields are directly accessible.

Yongle Hu (Oct 26 2024 at 11:04):

I think @Yuyang Zhao

Eric Wieser (Oct 26 2024 at 11:35):

I don't see how extending Equivalence could work

François G. Dorais (Oct 26 2024 at 12:57):

structure Rel (α β) where r : α  β  Prop
structure Setoid (α) extends Rel α α, Equivalence toRel.r

Eric Wieser (Oct 26 2024 at 13:11):

Replacing docs#Rel I guess

Andrew Yang (Oct 26 2024 at 15:01):

That would cause friction on the Rel side though.
Why not just define lemma Setoid.refl (r) := r.is_equiv.refl etc?

François G. Dorais (Oct 26 2024 at 15:45):

Right, better not replace Rel then.

private structure Setoid.Rel (α) where r : α  α  Prop
structure Setoid (α) extends Setoid.Rel α, Equivalence toRel.r

The main point is to have a nice construction syntax:

def foo (α) : Setoid α where
  r x y := sorry
  refl := sorry
  symm := sorry
  trans := sorry

Eric Wieser (Oct 27 2024 at 00:25):

is_eqv.refl := sorry isn't much worse

François G. Dorais (Oct 27 2024 at 01:24):

I don't understand.

François G. Dorais (Oct 27 2024 at 01:36):

Ah! Do you mean this?

def foo (α) : Setoid α where
  r x y := sorry
  iseqv.refl := sorry
  iseqv.symm := sorry
  iseqv.trans := sorry

François G. Dorais (Oct 27 2024 at 01:39):

Surely Setoid.iseqvneeds to be corrected.

Eric Wieser (Oct 27 2024 at 09:57):

I agree that iseqv doesn't match #naming


Last updated: May 02 2025 at 03:31 UTC