Skip to content

Fix lt in ZFRat on v4.31.0 - #5

Merged
VTrelat merged 2 commits into
mainfrom
v4.31.0
Jul 9, 2026
Merged

Fix lt in ZFRat on v4.31.0#5
VTrelat merged 2 commits into
mainfrom
v4.31.0

Conversation

@VTrelat

@VTrelat VTrelat commented Jul 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

VTrelat added 2 commits July 9, 2026 11:28
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
@VTrelat
VTrelat merged commit 72fffa8 into main Jul 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant