Zulip Chat Archive

Stream: lean4

Topic: Array.map def_eq


Violeta Hernández (Sep 28 2024 at 01:10):

How come the first is def-eq but the second isn't?

-- works
example : ([1, 1, 1].map (· + 1))[1] = 2 := rfl
-- fails
example : (#[1, 1, 1].map (· + 1))[1] = 2 := rfl

Violeta Hernández (Sep 28 2024 at 01:12):

(on a somewhat related note, we seem to be missing Array.getElem_map for Batteries.Vector)

Violeta Hernández (Sep 28 2024 at 01:20):

Oh I see, docs#Array.mapM.map is irreducible

Violeta Hernández (Sep 28 2024 at 01:21):

What's the reasoning behind this?

Mario Carneiro (Sep 28 2024 at 03:02):

it's because it's defined by well founded recursion, these get automatically marked as irreducible

Violeta Hernández (Sep 28 2024 at 03:17):

This can be overriden, right? Would it make sense to PR that change?

Kim Morrison (Sep 28 2024 at 04:44):

Works fine on nightly-testing. (In general at the moment, anything to do with Array should be assumed to possibly work differently on nightlies. :-)

Kim Morrison (Sep 28 2024 at 04:45):

getElem_map for Batteries.Vector would be nice, though!


Last updated: May 02 2025 at 03:31 UTC