# Question 8297: Stable Rational Sort with Original Index Witnesses

[Return to catalogue page 42](https://ocme.evemisslab.com/en/questions/page/42/)

[← Question derivation index](https://ocme.evemisslab.com/en/questions/) · [Original question batch](https://ocme.evemisslab.com/en/practice/batch-20261012-advance-20261017-r04-order-relation-foundations/#q-20261012-advance-20261017-r04-order-relation-0022)

This teaching derivation has second-context AI mathematical and bilingual semantic review, limited to the model and assumptions stated in this question. It has no human review or new Lean proof and does not promote the original question or MKO to Canonical truth.

R0015-08297 · q-20261012-advance-20261017-r04-order-relation-0022



## Original question and givens

Use the usual total order on R, restricted to exact rational inputs whose original denominators are positive. Output reduced fractions with positive denominators, retaining /1; do not extrapolate to arbitrary partial orders or complex numbers. Ordered inputs=[9/3, 1/2, -1/4]. Give (normalized inputs, stable sorted original indices, sorted values, adjacent comparison symbols). Equal values retain their original index order.


- G001 — Use the usual total order on R, restricted to exact rational inputs whose original denominators are positive. Output reduced fractions with positive denominators, retaining /1; do not extrapolate to arbitrary partial orders or complex numbers. Ordered inputs=[9/3, 1/2, -1/4]. Give (normalized inputs, stable sorted original indices, sorted values, adjacent comparison symbols). Equal values retain their original index order.





## Definition and scope

Use the original question domain, assumptions and cited MKO definitions. This item has second-context mathematical and bilingual review, with the model, answer and every arithmetic step independently recomputed from the original parameters; the source question remains a candidate.


- [mko-order-relation](https://ocme.evemisslab.com/en/mko/mko-order-relation/)





## Step-by-step derivation

S001 · impliesBefore

usual total order on R;all original denominators positive

After

closed endpoints included;negative scaling reverses;zero collapses

Conditions: none

These exact rationals use the usual real total order,not complex numbers or an arbitrary partial order.Original denominators must be positive;normalizing a negative input denominator does not waive that contract.

Step identifiers and dependenciesRule: real_rational_order_scope · Uses: G001





S002 · calculationBefore

original pair0,1 left cross := mul(3, 2)

After

original pair0,1 left cross = 6

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S001





S003 · calculationBefore

original pair0,1 right cross := mul(1, 1)

After

original pair0,1 right cross = 1

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S002





S004 · calculationBefore

original pair0,1 cross residual := sub(6, 1)

After

original pair0,1 cross residual = 5

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S003





S005 · impliesBefore

original pair0,1:fractions=[3/1, 1/2]

After

cross residual=5;comparison=>

Conditions: none

Reduced denominators are positive,so the cross-difference sign determines order.Retain equality and use original indices separately to break equal-value sorting ties.

Step identifiers and dependenciesRule: rational_positive_denominator_comparison · Uses: G001, S004





S006 · calculationBefore

original pair0,2 left cross := mul(3, 4)

After

original pair0,2 left cross = 12

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S005





S007 · calculationBefore

original pair0,2 right cross := mul(-1, 1)

After

original pair0,2 right cross = -1

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S006





S008 · calculationBefore

original pair0,2 cross residual := sub(12, -1)

After

original pair0,2 cross residual = 13

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S007





S009 · impliesBefore

original pair0,2:fractions=[3/1, -1/4]

After

cross residual=13;comparison=>

Conditions: none

Reduced denominators are positive,so the cross-difference sign determines order.Retain equality and use original indices separately to break equal-value sorting ties.

Step identifiers and dependenciesRule: rational_positive_denominator_comparison · Uses: G001, S008





S010 · calculationBefore

original pair1,2 left cross := mul(1, 4)

After

original pair1,2 left cross = 4

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S009





S011 · calculationBefore

original pair1,2 right cross := mul(-1, 2)

After

original pair1,2 right cross = -2

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S010





S012 · calculationBefore

original pair1,2 cross residual := sub(4, -2)

After

original pair1,2 cross residual = 6

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S011





S013 · impliesBefore

original pair1,2:fractions=[1/2, -1/4]

After

cross residual=6;comparison=>

Conditions: none

Reduced denominators are positive,so the cross-difference sign determines order.Retain equality and use original indices separately to break equal-value sorting ties.

Step identifiers and dependenciesRule: rational_positive_denominator_comparison · Uses: G001, S012





S014 · calculationBefore

sorted adjacent0 left cross := mul(-1, 2)

After

sorted adjacent0 left cross = -2

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S013





S015 · calculationBefore

sorted adjacent0 right cross := mul(1, 4)

After

sorted adjacent0 right cross = 4

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S014





S016 · calculationBefore

sorted adjacent0 cross residual := sub(-2, 4)

After

sorted adjacent0 cross residual = -6

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S015





S017 · impliesBefore

sorted adjacent0:fractions=[-1/4, 1/2]

After

cross residual=-6;comparison=<

Conditions: none

Reduced denominators are positive,so the cross-difference sign determines order.Retain equality and use original indices separately to break equal-value sorting ties.

Step identifiers and dependenciesRule: rational_positive_denominator_comparison · Uses: G001, S016





S018 · calculationBefore

sorted adjacent1 left cross := mul(1, 1)

After

sorted adjacent1 left cross = 1

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S017





S019 · calculationBefore

sorted adjacent1 right cross := mul(3, 2)

After

sorted adjacent1 right cross = 6

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S018





S020 · calculationBefore

sorted adjacent1 cross residual := sub(1, 6)

After

sorted adjacent1 cross residual = -5

Conditions: none

Substitute the source data exactly in the stated operand order;division requires a nonzero denominator.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S019





S021 · impliesBefore

sorted adjacent1:fractions=[1/2, 3/1]

After

cross residual=-5;comparison=<

Conditions: none

Reduced denominators are positive,so the cross-difference sign determines order.Retain equality and use original indices separately to break equal-value sorting ties.

Step identifiers and dependenciesRule: rational_positive_denominator_comparison · Uses: G001, S020





S022 · impliesBefore

normalized original values=[3/1, 1/2, -1/4]

After

stable original indices=[2, 1, 0];sorted values=[-1/4, 1/2, 3/1]

Conditions: none

Preserve original index order when values tie.Repeated values remain separate entries rather than being deduplicated as a set.

Step identifiers and dependenciesRule: stable_rational_original_index_sort · Uses: G001, S021









## Reverse checks


- S022 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S021 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S020 · premise_and_result_audit — Recompute sorted adjacent1 cross residual with exact rational arithmetic, not rounded decimals.
- S019 · premise_and_result_audit — Recompute sorted adjacent1 right cross with exact rational arithmetic, not rounded decimals.
- S018 · premise_and_result_audit — Recompute sorted adjacent1 left cross with exact rational arithmetic, not rounded decimals.
- S017 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S016 · premise_and_result_audit — Recompute sorted adjacent0 cross residual with exact rational arithmetic, not rounded decimals.
- S015 · premise_and_result_audit — Recompute sorted adjacent0 right cross with exact rational arithmetic, not rounded decimals.
- S014 · premise_and_result_audit — Recompute sorted adjacent0 left cross with exact rational arithmetic, not rounded decimals.
- S013 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S012 · premise_and_result_audit — Recompute original pair1,2 cross residual with exact rational arithmetic, not rounded decimals.
- S011 · premise_and_result_audit — Recompute original pair1,2 right cross with exact rational arithmetic, not rounded decimals.
- S010 · premise_and_result_audit — Recompute original pair1,2 left cross with exact rational arithmetic, not rounded decimals.
- S009 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S008 · premise_and_result_audit — Recompute original pair0,2 cross residual with exact rational arithmetic, not rounded decimals.
- S007 · premise_and_result_audit — Recompute original pair0,2 right cross with exact rational arithmetic, not rounded decimals.
- S006 · premise_and_result_audit — Recompute original pair0,2 left cross with exact rational arithmetic, not rounded decimals.
- S005 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.
- S004 · premise_and_result_audit — Recompute original pair0,1 cross residual with exact rational arithmetic, not rounded decimals.
- S003 · premise_and_result_audit — Recompute original pair0,1 right cross with exact rational arithmetic, not rounded decimals.
- S002 · premise_and_result_audit — Recompute original pair0,1 left cross with exact rational arithmetic, not rounded decimals.
- S001 · premise_and_result_audit — Check against the original data and this step's premises; a one-way implication is not an equivalence.





## Result

([3/1, 1/2, -1/4], [2, 1, 0], [-1/4, 1/2, 3/1], [<, <])

The full substitutions and premise checks give the original answer; source identity,format and status are unchanged.





## This question review and source binding

Review date: 2026-10-26

Original questions, answers, step expressions, numeric ASTs and historical records are retained. Source candidate labels remain historical and are not overwritten as formal proof.

Source hashes and review receipts
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: ea37988edc9c0d1784d91a1e0414cb25d95ecb1d2d0926369f93060b3a60659d
- candidate record SHA-256: 4ff031a07855629cc39943507680248aba6da08dc8223255befc90aca9bcbaae
- semantic review receipt SHA-256: 6ecad9d909199221a07e923f87425e80b3bdec3eed46fe5910d04fca694cae18
- question-first witness SHA-256: e8f00458977a09493b5f9f05ab9e6feec72debaf4c7d1c609d1fc95900a35a1b
- Lean: NOT_RUN · human review: NOT_PERFORMED

[Same-source full JSON](https://ocme.evemisslab.com/data/question-derivations/questions/q-20261012-advance-20261017-r04-order-relation-0022.json)




