Skip to content

Conversation

@zwarich
Copy link
Contributor

@zwarich zwarich commented Jun 12, 2025

This PR changes the implementation of computed fields in the new compiler, which should enable more optimizations (and remove a questionable hack in toLCNF that was only suitable for bringup). We convert casesOn to cases like we do for other inductive types, all constructors get replaced by their real implementations late in the base phase, and then the cases expression is rewritten to use the real constructors in toMono.

In the future, it might be better to move to a model where the cases expression gets rewritten earlier or the constructors get replaced later, so that both are done at the same time.

@zwarich zwarich added the changelog-compiler Compiler, runtime, and FFI label Jun 12, 2025
@zwarich zwarich requested a review from leodemoura as a code owner June 12, 2025 22:03
@zwarich zwarich enabled auto-merge June 12, 2025 22:19
@zwarich zwarich added this pull request to the merge queue Jun 12, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 12, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jun 12, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6a698c1c22043cd4c3a1ef0eae4fcd4b334365ee --onto faffe863343211d03d07d4ef19d90a2aa9d6fc8c. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-12 22:34:29)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 8aa003bdfca4cdb67ab0ac89ff8d85c545cf0525 --onto faffe863343211d03d07d4ef19d90a2aa9d6fc8c. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-12 23:33:43)

@zwarich zwarich removed this pull request from the merge queue due to a manual request Jun 12, 2025
@zwarich zwarich force-pushed the computed-fields-redux branch from 95a9698 to fa01115 Compare June 12, 2025 23:04
@zwarich zwarich enabled auto-merge June 12, 2025 23:04
@zwarich zwarich added this pull request to the merge queue Jun 12, 2025
Merged via the queue into leanprover:master with commit deda28e Jun 12, 2025
15 checks passed
algebraic-dev pushed a commit to algebraic-dev/lean4 that referenced this pull request Jun 18, 2025
…the new compiler (leanprover#8754)

This PR changes the implementation of computed fields in the new
compiler, which should enable more optimizations (and remove a
questionable hack in `toLCNF` that was only suitable for bringup). We
convert `casesOn` to `cases` like we do for other inductive types, all
constructors get replaced by their real implementations late in the base
phase, and then the `cases` expression is rewritten to use the real
constructors in `toMono`.

In the future, it might be better to move to a model where the `cases`
expression gets rewritten earlier or the constructors get replaced
later, so that both are done at the same time.
wkrozowski pushed a commit to wkrozowski/lean4 that referenced this pull request Jun 24, 2025
…the new compiler (leanprover#8754)

This PR changes the implementation of computed fields in the new
compiler, which should enable more optimizations (and remove a
questionable hack in `toLCNF` that was only suitable for bringup). We
convert `casesOn` to `cases` like we do for other inductive types, all
constructors get replaced by their real implementations late in the base
phase, and then the `cases` expression is rewritten to use the real
constructors in `toMono`.

In the future, it might be better to move to a model where the `cases`
expression gets rewritten earlier or the constructors get replaced
later, so that both are done at the same time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-compiler Compiler, runtime, and FFI toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants