Zulip Chat Archive

Stream: new members

Topic: finset union


Patrick Thomas (Apr 17 2022 at 20:46):

How would I take the finset union over a function from fin n to finset? That is, I think I want ∪_{i : fin n}, f i where f: fin n -> finset.

Kevin Buzzard (Apr 17 2022 at 20:48):

Is it docs#finset.bUnion ? Yeah that'll do it, use finset.univ to get all of fin n as a finset

Eric Wieser (Apr 17 2022 at 20:52):

If you don't care about computability ⨆ i, f i will work

Patrick Thomas (Apr 17 2022 at 20:53):

So like:

inductive term : Type
| var : string  term
| func {n} : string  (fin n  term)  term

def term.all_var_set : term  finset string
| (var x) := {x}
| (func f args) := finset.bUnion finset.univ (fun i, term.all_var_set (args i))

?

Patrick Thomas (Apr 17 2022 at 20:54):

I think I care about computability here.

Patrick Thomas (Apr 17 2022 at 21:00):

Thank you.

Eric Wieser (Apr 17 2022 at 21:00):

That looks good to me

Patrick Thomas (Apr 17 2022 at 21:00):

Great! Thank you!


Last updated: Dec 20 2023 at 11:08 UTC