-
Notifications
You must be signed in to change notification settings - Fork 247
[ refactor ] Restate, and use, the definitions of Monotonic
etc. operations
#2580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks - these already are easier to understand. |
How do I remove #1579 from the |
Not sure how you did it, but it's gone for me 🎉 |
Now that the abstract definitions are mostly in place, can look at the instantiations in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming along nicely.
Remark: all of the |
So this should now be ready, modulo:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise looks really good! Massive improvement.
src/Data/Nat/Properties.agda
Outdated
*-monoʳ-≤ : ∀ n → (n *_) Preserves _≤_ ⟶ _≤_ | ||
*-monoʳ-≤ n m≤o = *-mono-≤ (≤-refl {n}) m≤o | ||
*-monoʳ-≤ : LeftMonotonic _≤_ _≤_ _*_ | ||
*-monoʳ-≤ = mono₂⇒monoˡ {≤₁ = _≤_} {≤₂ = _≤_} {≤₃ = _≤_} ≤-refl *-mono-≤ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This providing of implicits is annoying. Suggests that some of them should be explicit in the proof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've been scratching my head over how it might be avoided... without a conclusion yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if you make all 3 underscores, which ones are yellow? I notice that the previous proof provided the n
explicitly, might that work here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that only {≤₃ = _≤_}
is required here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaargh: there's a difference depending on whether we consider left or right, presumably because of the left-biased implementations. Will need to investigate further. Sigh.
*-monoˡ-≤ : RightMonotonic _≤_ _≤_ _*_
*-monoˡ-≤ = mono₂⇒monoʳ {≤₃ = _≤_} ≤-refl *-mono-≤
*-monoʳ-≤ : LeftMonotonic _≤_ _≤_ _*_
*-monoʳ-≤ = mono₂⇒monoˡ {≤₁ = _≤_} {≤₂ = _≤_} {≤₃ = _≤_} ≤-refl *-mono-≤
src/Data/Nat/Properties.agda
Outdated
+-monoʳ-≤ : ∀ n → (n +_) Preserves _≤_ ⟶ _≤_ | ||
+-monoʳ-≤ n m≤o = +-mono-≤ (≤-refl {n}) m≤o | ||
+-monoʳ-≤ : LeftMonotonic _≤_ _≤_ _+_ | ||
+-monoʳ-≤ = mono₂⇒monoˡ {≤₃ = _≤_} ≤-refl +-mono-≤ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here just 1 suffices:
+-monoˡ-≤ : RightMonotonic _≤_ _≤_ _+_
+-monoˡ-≤ = mono₂⇒monoʳ {≤₃ = _≤_} ≤-refl +-mono-≤
+-monoʳ-≤ : LeftMonotonic _≤_ _≤_ _+_
+-monoʳ-≤ = mono₂⇒monoˡ {≤₃ = _≤_} ≤-refl +-mono-≤
I'll resolve the merge conflict later, meanwhile tricky questions above needing more thought... ;-)... so have converted back to DRAFT. |
src/Data/Nat/Properties.agda
Outdated
*-monoʳ-≤ : ∀ n → (n *_) Preserves _≤_ ⟶ _≤_ | ||
*-monoʳ-≤ n m≤o = *-mono-≤ (≤-refl {n}) m≤o | ||
*-monoʳ-≤ : LeftMonotonic _≤_ _≤_ _*_ | ||
*-monoʳ-≤ = mono₂⇒monoˡ {≤₁ = _≤_} {≤₂ = _≤_} {≤₃ = _≤_} ≤-refl *-mono-≤ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if you make all 3 underscores, which ones are yellow? I notice that the previous proof provided the n
explicitly, might that work here as well?
Aim: towards tackling #1579
TODO:
Data.Nat.*
UPDATED: unsolved metas suggest some more revision is necessary :-(Data.Integer.*
Data.Rational.*
breaking
changes (v3.0: separate PR once the rest is done?)