Conversation
The original `lt` compared raw cross-multiplied numerators directly (a*d < c*b), which is only correct when both denominators share the same sign. Since ZFInt' only requires nonzero (not positive) denominators, two representatives of the same rational can disagree in sign, making the old formula give different truth values for equivalent inputs (counterexample: 1/2 vs -1/-2 compared against 1/3). Redefine positivity via `isPos z := 0 < z.num * z.den`, well-defined by a squaring argument (multiply the cross-mult equation by den*den), and derive `lt x y := isPos (y - x)`, which is well-defined for free since it composes already-well-defined quotient operations. Add isPos_eq/lt_eq unfolding lemmas matching the file's existing _eq convention.
Build on the now-sound isPos/lt to establish: - isPos cone lemmas (trichotomy, closure under +/*, not both z and -z) - lt/le order facts (irrefl, asymm, trans, trichotomy, refl, antisymm, total) derived from the cone - LinearOrder ZFRat - IsOrderedRing, PosMulStrictMono, MulPosStrictMono ZFRat, mirroring the compositional mixin style already used for ZFInt's order instances rather than the older monolithic LinearOrderedRing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.