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

feat: (experiment) have synth order defer "mixin" instances #7313

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Mar 4, 2025

This PR is a draft that's trying a new approach to what I was doing in #7310

The idea is that we can detect "mixin" arguments, assume that they're more likely than not to be inferable from the instance argument they're mixed into, and defer their synthesis.

In general, mixin arguments get promoted to be instance implicit, even if they were implicit.

kmill added 3 commits March 3, 2025 13:40
This PR modifies the instance synth order checker to detect projections-like instances, rather having special support only for constructor field projections. An instance is projection-like if the first instance implicit argument has a type that's a constant applied to all the preceding arguments in order — these arguments are assumed to be the parameters of the type.

In the future the `class` command will make all its generated parent projections use implicits for all parameters, making the generated projections all consistent.
@kmill kmill changed the title (experiment) have synth order defer "mixin" instances feat: (experiment) have synth order defer "mixin" instances Mar 4, 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 Mar 4, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 4, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 4, 2025
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Mar 4, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Mar 4, 2025

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR 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