Zulip Chat Archive

Stream: general

Topic: Fixed-length arrays


Shelvacu (Apr 14 2025 at 01:36):

Is there a standard type (whether in the actual stdlib or some other common library) for representing fixed-size arrays somewhat efficiently? Or should I just be using something like { xs : Array a // a.size = 5 }?

Aaron Liu (Apr 14 2025 at 01:36):

docs#Vector or docs#List.Vector

Kim Morrison (Apr 14 2025 at 02:06):

Moreover, the API for List/Array that is provided in the standard library should (nearly) all be reproduced for Vector. If you find omissions, please ping me. :-)

Bhavik Mehta (Apr 14 2025 at 02:15):

Some of the things around sorting are missing for Vector, eg Array.insertionSort, Array.qsort and Array.binSearch

Kim Morrison (Apr 14 2025 at 06:00):

Verification for Array.qsort coming soon (more as a demo of how great grind is than actually caring about qsort), and I will try to add the Vector wrappers and API along with that.

Mario Carneiro (Apr 14 2025 at 11:15):

I could have sworn I already submitted a proof of qsort ages ago

Mario Carneiro (Apr 14 2025 at 11:17):

see lean4#3933 and lean4#5346

Shreyas Srinivas (Apr 14 2025 at 11:18):

Bhavik Mehta said:

Some of the things around sorting are missing for Vector, eg Array.insertionSort, Array.qsort and Array.binSearch

You should be able to lift the array theorems into vectors for now. If I had to guess, that’s what the vector API will do

Kim Morrison (Apr 14 2025 at 13:26):

Yes, both lean#3933 and lean#5346 were sadly abandoned.

Bhavik Mehta (Apr 14 2025 at 14:33):

Shreyas Srinivas said:

Bhavik Mehta said:

Some of the things around sorting are missing for Vector, eg Array.insertionSort, Array.qsort and Array.binSearch

You should be able to lift the array theorems into vectors for now. If I had to guess, that’s what the vector API will do

Sure, it's not too hard to work around, but it's still an omission!

Mario Carneiro (Apr 14 2025 at 14:42):

Kim Morrison said:

Yes, both lean#3933 and lean#5346 were sadly abandoned.

lean4#3933 was not abandoned by me, there were some unclear blocking concerns about benchmarking despite plenty of existing benchmarks


Last updated: May 02 2025 at 03:31 UTC