Zulip Chat Archive

Stream: new members

Topic: Indexed families of sets


Logan Murphy (Jul 19 2020 at 00:06):

When I declare a family of sets indexed by naturals as in

variable α : Type

variable A :   set α

does Lean assume that A is an infinite family of sets? If I want to assert that A is a finite family of sets indexed by naturals, can I still use ℕ as the index set or do I have to make some workaround?

Bryan Gin-ge Chen (Jul 19 2020 at 00:09):

Lean doesn't assume anything about the image of A.

Logan Murphy (Jul 19 2020 at 00:43):

If I wanted to define a structure where each instance of the structure has an indexed family of n sets , for a particular n, is there a good way to accomplish this? I think the method below works but I'm wondering if I can omit the (i \leq n) somehow.

import data.nat.basic
import data.set.basic
open set nat

variables {α β: Type}

structure ind_fam (α : Type) :=
(n : )
(A :  (i : ), (i  n)  set α)

Dan Stanescu (Jul 19 2020 at 01:35):

Take a look at fin n. This may be what you need, but I haven't quite used it before.

structure ind_fam (α : Type) :=
(n : )
(A : fin (n+1)  set α)

Kevin Buzzard (Jul 19 2020 at 10:07):

fin (n+1) has size n+1.

Dan Stanescu (Jul 19 2020 at 13:47):

I thought that was what the initial post meant by (i : ℕ), (i ≤ n), but maybe you mean to say something I don't grasp yet.

Dan Stanescu (Jul 19 2020 at 13:47):

@Logan Murphy The type fin n is a package made of a value, which is a natural number, together with a proof that the value is strictly less than n. So fin (n+1) is the set {0,1,...,n} because in Lean naturals start at 0.


Last updated: Dec 20 2023 at 11:08 UTC