Zulip Chat Archive

Stream: general

Topic: What is the standard Set package or import


Mason McBride (Nov 19 2023 at 05:20):

I'm interested as to why there seems to be different definitions of a set like 'Set' and 'set' and 'Setoid' and 'finset' which one should I be using? What is the history?

Mario Carneiro (Nov 19 2023 at 05:21):

Note, the lowercased names no longer exist, those look like they are from the lean 3 naming convention

Mario Carneiro (Nov 19 2023 at 05:22):

The lean 4 version of those would be ZFSet, Set, Setoid, Finset respectively

Mario Carneiro (Nov 19 2023 at 05:25):

  • Set A: an arbitrary subset of base type A
  • Finset A: a finite set (with some computational content as a list of elements)
  • Setoid A: an equivalence relation on a type (this isn't really a set, the naming is borrowed from Coq)
  • ZFSet: a ZFC-style set for use in set theory formalization

Mario Carneiro (Nov 19 2023 at 05:25):

you pretty much always want the first one, unless you are doing summation over finite sets in which case you will need the second one

Mason McBride (Nov 19 2023 at 05:41):

import Mathlib.Init.Set
set_option autoImplicit false
universe u

variable (α : Type u) (X Y Z : Set α)
theorem please (f: X  Y) (g: Y  Z) : Set.image (f  g) = Set.image f  Set.image g := by rfl

What is wrong here

Ruben Van de Velde (Nov 19 2023 at 06:28):

  1. You're not importing enough of mathlib for lean to know what you mean when you try to use a set where a type of expected
  2. You've got the order wrong for the composition operator
  3. The proof needs more work

Eric Wieser (Nov 19 2023 at 11:01):

  1. It looks like you're muddling Set and Type

Last updated: Dec 20 2023 at 11:08 UTC