Skip to content

Disastrous expansion of operations in Data.Rational.Base #1753

@MatthewDaggitt

Description

@MatthewDaggitt

The operations such as addition and multiplication in Data.Rational.Base are defined in terms of the numerator and denominator projection operations, e.g.

_+_ :
p + q = (↥ p ℤ.* ↧ q ℤ.+ ↥ q ℤ.* ↧ p) / (↧ₙ p ℕ.* ↧ₙ q)

This is beautiful and elegant, and arguably the right way to define them. However, it does mean that Agda unfolds these definitions automatically. By the time you have an expression x + y + z + a + b + c the unfolded expression is over 200 lines long.

This makes the rational numbers almost impossible to work with in large proofs. In recent proofs I've resorted to redefining everything that's needed under the abstract keyword.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions