Skip to content

DefEq transitivity failures for unit-like eta #2258

Closed

Description

@arthur-adjedj

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

The criteria for isDefEqUnitLike is not strong enough, and leads to failures of transitivity of the definitional equality:

Steps to Reproduce

example (p : α → Unit) : p = λ _ => ()   := rfl --works
example (q : α → Unit) : (λ _ => ()) = p := rfl --works
example (p q : α → Unit) : p = q         := rfl --fails

structure Foo where
    foo : Unit

example (p : Foo) : p = ⟨()⟩ := rfl --works
example (q : Foo) : ⟨()⟩ = q := rfl --works
example (p q : Foo) : p = q := rfl --fails

structure Bar : Type where
    bar : True

example (p : Bar) : p = ⟨.intro⟩ := rfl --works
example (q : Bar) : ⟨.intro⟩ = q := rfl --works
example (p q : Bar) : p = q := rfl --fails

Expected behavior: All these examples should work

Actual behavior: some fail

Reproduces how often: 100%

Versions

4.0.0-nightly-2023-06-01

Additional Information

Agda supports eta-for-unit defeq, and uses a type-based approach similar to lean's for its record types and arrow types. Currently in lean, unit-like types are inductive types with one constructor and no fields in said constructor. The fix would be to extend this criteria such that any arrow type whose codomain is unit-like is itself unit-like, and any structure-like inductive for which all fields are unit-like is itself unit-like.

Activity

  1. added 4 commits that reference this issue on Jul 17, 2023
    ff79264
    ccba76a
    6906c5b
    7eedcbd
  2. arthur-adjedj commented on Jul 17, 2023

    @arthur-adjedj
    ContributorAuthor

    I've taken the liberty of making a fix for this issue on a fork, by extending the criteria for which a type may be considered unit-like. Would a PR for this be welcomed ?

  3. added a commit that references this issue on Jul 19, 2023
    34a7c5e
  4. added
    P-low
    on Feb 11, 2025
  5. changed the title [-]DefEq transitivity failures for eta[/-] [+]DefEq transitivity failures for unit-like eta[/+] on Feb 17, 2026
  6. added a commit that references this issue on Oct 20, 2026
    43d3355
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-low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions