Repository navigation
A lambda is applied to its argument before its body is simplified - #2156
Merged
Rafael-SOWNet merged 1 commit intoOct 27, 2026
Merged
Conversation
Simplifying an application simplified the lambda first and put the argument into what came back. A simplified body treats its parameter as a number, as every symbol is one, so [[0, -1], [1, 0]] * u became [[0, -u], [u, 0]], and the vector [p, q] put in for u gave the matrix of vectors [[0, [-p, -q]], [[p, q], 0]] where the product is [-q, p]. A dot product written [1, 1]T * u gave [[[p, q], [p, q]]] for p + q. A lambda written in place is now applied to its argument first, and the result simplified. A lambda that only appears once its function part is simplified is applied as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2132.
A wrong answer: applying a lambda to a vector gave a matrix of vectors.
apply(lambda(u, [[0, -1], [1, 0]] * u), [p, q])[[0, [-p, -q]], [[p, q], 0]][-q, p]apply(lambda(u, [1, 1]T * u), [p, q])[[[p, q], [p, q]]]p + qCause.
Application.InnerSimplifysimplified the lambda first and then put the argument into what came back. A simplified body treats its parameter as a number, as every symbol is one, so[[0, -1], [1, 0]] * uhad already become[[0, -u], [u, 0]]by the time[p, q]went in.Fix. A lambda written in place is applied to its argument first, and the result is then simplified. A lambda that only appears once the function part is simplified is applied as before.
Checked:
LambdaCalculusTest, including a two-parameter lambda.apply(lambda(x, x * x), [1, 2])still simplifies to[1, 4]on this branch. That is #2141's elementwise power, which #2155 fixes.Found while reading Modenov's Problems in Geometry for #2131, whose rotation of a plane vector through π/2 is this lambda.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura