Zulip Chat Archive

Stream: Is there code for X?

Topic: finset to list


Kevin Buzzard (Oct 28 2021 at 11:17):

1) Do we have a noncomputable finset X -> list X (a one-sided inverse of list.to_finset)? I can make it but if it's there already I'd rather use what's there. I was hoping to use #find to find it but I failed.

2) If X has decidable equality and a total ordering, do we have a computable finset X -> list X? Asking for a friend.

Eric Wieser (Oct 28 2021 at 11:28):

We have docs#finset.sort for 2)

Eric Wieser (Oct 28 2021 at 11:28):

As for 1, that's s.1.out I think (docs#finset.val, docs#quotient.out)

Kevin Buzzard (Oct 28 2021 at 11:29):

yes that was my construction for 1, I was just wondering if there was an API

Eric Wieser (Oct 28 2021 at 11:31):

I doubt there is, given there's not even API for m.out whenm : multiset X

Kevin Buzzard (Oct 28 2021 at 11:31):

as for 2 I've never looked at that file before! Thanks! This is for an MSc student who's been doing too much Agda

Yakov Pechersky (Oct 28 2021 at 11:48):

It begs the question, what's the list going to be used for?

Reid Barton (Oct 28 2021 at 11:54):

maybe printing it to the screen? :scream:

Eric Wieser (Oct 28 2021 at 11:54):

Well then 1) probably isn't an option

Eric Wieser (Oct 28 2021 at 11:55):

You need quot.unquot s.1 instead if you're trying to print

Joseph Hua (Oct 28 2021 at 12:20):

its for reconstructing multivariable polynomials over a field as (symbolic) sums of monomials in the terms in the language of rings. since it is symbolic (hence not having add_comm_monoid) i can't make sums using finset

Eric Wieser (Oct 28 2021 at 12:29):

i can't make sums using finset

Why not?

Yakov Pechersky (Oct 28 2021 at 12:59):

We defined a noncomm_sum for finset such that you can still sum when the underlying addition isn't commutative but in the finset it is.

Yakov Pechersky (Oct 28 2021 at 13:04):

Not sure why docs linkifier won't link it

Eric Wieser (Oct 28 2021 at 13:07):

I suspect the problem is that (add x y) = (add y x) is not true in Joseph's "symbolic" terms

Yakov Pechersky (Oct 28 2021 at 13:09):

Whatever the sum is over your extracted list, if you're going to be using it, you'll have to prove at some point that it didn't matter which list you extracted. Or am I misunderstanding something?

Floris van Doorn (Oct 28 2021 at 13:19):

Yakov is talking about docs#finset.noncomm_sum.

Reid Barton (Oct 28 2021 at 13:46):

Is this for a tactic or for some internal argument?

Reid Barton (Oct 28 2021 at 13:51):

e.g. if you're trying to prove an internal proposition like "for any polynomial fR[x,y]f \in R[x,y], there exists a term in the language of an RR-algebra extended by two constant symbols XX and YY that interprets to ff when we set X=xX = x and Y=yY = y" then you don't need either 1) or 2)

Kevin Buzzard (Oct 28 2021 at 14:43):

I think that this will be one of the things @Joseph Hua wants except with n variables not 2

Kevin Buzzard (Oct 28 2021 at 14:44):

he wants to see how much of the model theory proof of Ax-Grothendieck is feasible before we both get stuck

Joseph Hua (Oct 28 2021 at 15:17):

because sums using finset require having add_comm_monoid on the type, I only have has_zero, has_add, has_neg, has_one, has_mul

Kevin Buzzard (Oct 28 2021 at 15:25):

Yes, we're really in a position where the sum is not well-defined, but it is well-defined up to associativity and commutativity, so when the term is evaluated in ring theory it will be well-defined.

Adam Topaz (Oct 28 2021 at 15:33):

You can probably avoid model theory and still reduce from C\mathbb{C} to Fp\overline{\mathbb{F}_p} by specializing along a maximal valuation of C\mathbb{C} (whose residue field must be the algebraic closure of a finite field). Does anyone know is such an argument along these lines has been written down?

Eric Wieser (Oct 28 2021 at 15:47):

If you take a quotient by the kernel of evaluation map, then your addition becomes commutative

Eric Wieser (Oct 28 2021 at 15:48):

But also if you're using polynomials in a single variable (as opposed to mv_polynomial which wasn't mentioned above) then there's an obvious ordering of monomials anyway, so .sorted is indeed a sensible choice.

Kyle Miller (Oct 28 2021 at 17:09):

Kevin Buzzard said:

1) Do we have a noncomputable finset X -> list X

docs#finset.to_list

Kyle Miller (Oct 28 2021 at 17:13):

Eric Wieser said:

I doubt there is, given there's not even API for m.out whenm : multiset X

It's called docs#multiset.to_list instead.

Reid Barton (Oct 28 2021 at 17:14):

I see there is also docs#finset.exists_list_nodup_eq which is the kind of approach I had in mind


Last updated: Dec 20 2023 at 11:08 UTC