Unify ConditionalFormula evaluation and add algebraic fusion for chained NaturalArray transforms#88
Merged
DanexCodr merged 9 commits intoApr 12, 2026
Conversation
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/d041c95d-62d9-47f6-b0ee-a71fe3d10a62 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/d041c95d-62d9-47f6-b0ee-a71fe3d10a62 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/d041c95d-62d9-47f6-b0ee-a71fe3d10a62 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/e9013e40-5c5d-4ff0-bb9c-61f0042fc483 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/e9013e40-5c5d-4ff0-bb9c-61f0042fc483 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/40be63ba-f796-4997-9cd7-22680da225c2 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/40be63ba-f796-4997-9cd7-22680da225c2 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/40be63ba-f796-4997-9cd7-22680da225c2 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/40be63ba-f796-4997-9cd7-22680da225c2 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
DanexCodr
April 12, 2026 10:04
View session
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.
Implements the ConditionalFormula O(1) step by compiling conditional branches into a single arithmetic expression where purity allows, while preserving fallback semantics for non-encodable cases. It also closes key optimization gaps in simplification and introduces lazy fusion behavior for chained
map/filter/zipoverNaturalArrayviews.ConditionalFormula expression unification
c*A + (1-c)*Bfolded from tail to head).evaluate(...)per index for encodable formulas.Numeric condition layer + constant folding
and/or/!, comparison forms) with pure-only gating.Simplification pass expansion
a-a -> 0a+a -> 2*a(a*b)+(a*c) -> a*(b+c)(common-factor extraction)c*A + (1-c)*A -> A+,-,*, and exact integer/.Formula lifecycle in NaturalArray
Lazy map/filter/zip fusion in LiteralRegistry
map(...).map(...)) into a single mapper pipeline.filter(...).filter(...)) into a single predicate pipeline.Coverage updates
ConditionalFormulaOptimization.codwith: