Skip to content

Conversation

@leodemoura
Copy link
Member

@leodemoura leodemoura commented Jan 30, 2026

This PR adds the new transparency setting @[instance_reducible]. We used to check whether a declaration had instance reducibility by using the isInstance predicate. However, this was not a robust solution because:

  • We have scoped instances, and isInstance returns true only if the scope is active.

  • We have auxiliary declarations used to construct instances manually, such as:

    def lt_wfRel : WellFoundedRelation Nat

isInstance also returns false for this kind of declaration.

In both cases, the declaration may be (or may have been) used to construct an instance, but isInstance
returns false. Thus, we claim it is a mistake to check the reducibility status using isInstance.
isInstance indicates whether a declaration is available for the type class resolution mechanism,
not its transparency status.

We are decoupling whether a declaration is available for type class resolution from its transparency status.

Remak: We need a update stage0 to complete this feature.

@leodemoura leodemoura added the changelog-language Language features and metaprograms label Jan 30, 2026
@leodemoura leodemoura marked this pull request as draft January 30, 2026 04:25
@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 Jan 30, 2026
@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-01-28 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-01-30 05:29:19)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jan 30, 2026
@github-actions github-actions bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Jan 30, 2026
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jan 30, 2026
@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 Jan 30, 2026
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

@kim-em
Copy link
Collaborator

kim-em commented Jan 31, 2026

This panics all through Mathlib, here's an example:

section Mathlib.Logic.Basic

variable {a b : Prop}

theorem not_imp_not : ¬a → ¬b ↔ b → a := sorry

end Mathlib.Logic.Basic

section Mathlib.Logic.Nontrivial.Defs

class Nontrivial (α : Type) : Prop where
  exists_pair_ne : ∃ x y : α, x ≠ y

theorem not_subsingleton (α) [Nontrivial α] : ¬Subsingleton α := sorry

end Mathlib.Logic.Nontrivial.Defs

open Function

variable {α β : Sort} {f : α → β}

/-- PANIC -/
#guard_msgs (substring := true) in
theorem injective_comp_right_iff_surjective {γ : Type} [Nontrivial γ] :
    Injective (fun g : β → γ ↦ g ∘ f) ↔ Surjective f := by
  refine ⟨not_imp_not.mp fun not_surj inj ↦ not_subsingleton γ ⟨fun c c' ↦ ?_⟩,
    (·.injective_comp_right)⟩
  have ⟨b₀, hb⟩ := not_forall.mp not_surj
  classical have := inj (a₁ := fun _ ↦ c) (a₂ := (if · = b₀ then c' else c)) ?_
  sorry

@leodemoura leodemoura marked this pull request as ready for review February 1, 2026 01:30
@leodemoura leodemoura enabled auto-merge February 1, 2026 01:38
@leodemoura
Copy link
Member Author

This panics all through Mathlib, here's an example:

@kim-em It is the same panic that was affecting our stage2. It has been fixed.

@leodemoura leodemoura added this pull request to the merge queue Feb 1, 2026
Merged via the queue into master with commit 4606c35 Feb 1, 2026
15 checks passed
kim-em added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

6 participants