Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change list.prod from foldl to foldr #161

Open
spl opened this issue Jun 20, 2018 · 1 comment
Open

Change list.prod from foldl to foldr #161

spl opened this issue Jun 20, 2018 · 1 comment

Comments

@spl
Copy link
Collaborator

spl commented Jun 20, 2018

@kckennylau says: Was there any point in time where list.prod [t] was definitionally equivalent to t * 1? and was there any point in time where list.prod (x :: L) = x * list.prod L was rfl?

@johoelzl says: I traced it back, it was always foldl. I ported the definition from Lean2's library. I think we should change it to foldr then we get the expected equalities.

@johoelzl
Copy link
Collaborator

I remember now why we use foldl: a * b * c = (a * b) * c and [a, b, c].foldl (*) 1 = (((1 * a) * b) * c while [a, b, c].foldr (*) 1 = a * (b * (c * 1)), so the product is associated in the wrong direction.

But I think the definitional equalities are more important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants