| 1 |
From Coq Require Import ZArith. |
| 2 |
From Coq Require Import Lia. |
| 3 |
From Coq Require Import Mergesort. |
| 4 |
|
| 5 |
|
| 6 |
Module TAPOrder <: Orders.TotalLeBool. |
| 7 |
Local Coercion is_true : bool >-> Sortclass. |
| 8 |
Definition t := (Z * Z)%type. |
| 9 |
Definition leb (x y : t) := Z.geb (snd x) (snd y). |
| 10 |
Infix "<=?" := leb. |
| 11 |
Theorem leb_total : forall a1 a2, a1 <=? a2 \/ a2 <=? a1. |
| 12 |
Proof. |
| 13 |
intros; cbv [is_true leb]; rewrite !Z.geb_le; lia. |
| 14 |
Qed. |
| 15 |
End TAPOrder. |
| 16 |
|
| 17 |
Module TAPSort := Sort TAPOrder. |
| 18 |
|
| 19 |
Notation sort := TAPSort.sort. |