Skip to content

Eta-expansion of Prop-structures #3213

Closed

Description

@arthur-adjedj

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

During iota-reduction, terms of structures that live in Prop do not get eta-expanded. This was introduced in #1033 in order to avoid constructing primitive projections for terms that shouldn't have them (i.e existentials). However, the criteria applied is too strong, and blocks the reduction of subsingletons that could get eta-expanded otherwise. This, among other things, break both the transitivity and congruence of definitional equality.

Context

This issue has been reported by a few different users on Zulip: here, here and here

Steps to Reproduce

variable (P Q : Prop) (A : Type) (f : P → Q → A) (x : P ∧ Q)

example : And.rec f ⟨x.1,x.2⟩ = f (And.left x) (And.right x) := rfl --works
example : (And.rec f ⟨x.1,x.2⟩ : A) = And.rec f x  := rfl --fails

Expected behavior: both examples work

Actual behavior: The first one works, the second fails.

Versions

4.5.0-rc1
Web Browser

Additional Information

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Activity

  1. added
    bug
    on Jan 23, 2024
  2. added
    P-low
    on Sep 20, 2024
  3. b-mehta commented on Mar 11, 2025

    @b-mehta
    Contributor

    I just came across this too, in an example which more clearly (to me at least) shows why this breaks transitivity of defeq:

    example (x y : Nat) (h h' : PProd (x = 0) (y = 1)) : h = h' := by
      rfl -- fails
    
    example (x y : Nat) (h h' : PProd (x = 0) (y = 1)) : h = h' := calc
      h = ⟨h.1, h.2⟩ := rfl -- works
      _ = h' := rfl -- works
    
  4. added a commit that references this issue on Oct 20, 2026
    a849eb9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions