Skip to content

Try to improve reduction behaviour of rationals using Andreas's suggestion - #1764

Merged
MatthewDaggitt merged 1 commit into
masterfrom
rational-expansion
May 11, 2022
Merged

MatthewDaggitt merged 1 commit into
masterfrom
rational-expansion

Conversation

@MatthewDaggitt

Copy link
Copy Markdown
Collaborator

Closes #1753. Haven't addressed the problem with integer multiplication.

@JacquesCarette

Copy link
Copy Markdown
Collaborator

Very nice. I'm a little surprised at just how many times you had to force evaluation (in proofs - all the ones for defining functions makes sense).

I'm guessing none are actually intrinsic but are because of the choice of method of proof? Mostly curious, I don't think it's worth doing anything about it in this PR. But might be fun over time to slowly make these go away, to further decrease coupling from the proofs to the exact implementation.

@MatthewDaggitt

Copy link
Copy Markdown
Collaborator Author

I'm guessing none are actually intrinsic but are because of the choice of method of proof? Mostly curious, I don't think it's worth doing anything about it in this PR

Well, none of them are intrinsic if you add a single equality proof for each operation that equates the non-reduced form to the reduced form. I guess that would be the minimal use of normalisation. But yes, I'm afraid I don't have the will power to go and alter them all now. I will actively discourage any new proofs being added that do rely on the reduction behaviour.

@MatthewDaggitt
MatthewDaggitt merged commit 53e45bb into master May 11, 2022
@MatthewDaggitt
MatthewDaggitt deleted the rational-expansion branch May 11, 2022 08:13

>-nonZero : ∀ {p} → p > 0ℚ → NonZero p
>-nonZero {p} (*<* p<q) = ℚᵘ.>-nonZero {toℚᵘ p} (ℚᵘ.*<* p<q)
>-nonZero {p@(mkℚ _ _ _)} (*<* p<q) = ℚᵘ.>-nonZero {toℚᵘ p} (ℚᵘ.*<* p<q)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not the '@record' pattern here as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disastrous expansion of operations in Data.Rational.Base

3 participants