Skip to content

Commit 7aa5d80

Browse files
1 parent 90900f9 commit 7aa5d80

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

examples/bubblesort.v

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*)
1313

14-
From Coq Require Import ssreflect ssrbool ssrfun.
14+
From mathcomp Require Import ssreflect ssrbool ssrfun.
1515
From mathcomp Require Import ssrnat eqtype seq path fintype tuple.
16-
From mathcomp Require Import finfun fingroup perm interval.
16+
From mathcomp Require Import finfun fingroup perm order interval.
1717
From pcm Require Import options axioms prelude pred ordtype slice.
1818
From pcm Require Import seqext pcm unionmap heap.
19-
From htt Require Import options model heapauto.
20-
From htt Require Import array.
21-
From mathcomp Require order.
22-
Import order.Order.NatOrder order.Order.TTheory.
19+
From htt Require Import options model heapauto array.
20+
Import Order.NatOrder Order.TTheory.
2321
Local Open Scope order_scope.
22+
Local Open Scope nat_scope.
2423

2524
(* Brief mathematics of (bubble) array sorting: *)
2625
(* Theory of permutations built out of (adjacent-element) swaps acting on *)
@@ -114,13 +113,13 @@ Proof. by rewrite slice_xL // onth_codom1S. Qed.
114113

115114
(* TODO notation fails *)
116115
Lemma codom1_ax_rcons (f : {ffun 'I_n.+1 -> A}) (a : itv_bound nat) (i : 'I_n) :
117-
order.Order.le a (BLeft (i : nat)) ->
116+
Order.le a (BLeft (i : nat)) ->
118117
&:(fgraph f) (Interval a (BRight (i : nat))) =
119118
rcons (&:(fgraph f) (Interval a (BLeft (i : nat)))) (f (Wo i)).
120119
Proof. by move=>H; rewrite slice_xR //= onth_codom1 /=. Qed.
121120

122121
Lemma codom1_ax_rcons2 (f : {ffun 'I_n.+1 -> A}) (a : itv_bound nat) (i : 'I_n) :
123-
order.Order.le a (BLeft (i : nat)) ->
122+
Order.le a (BLeft (i : nat)) ->
124123
&:(fgraph f) (Interval a (BRight i.+1)) =
125124
rcons (rcons (&:(fgraph f) (Interval a (BLeft (i : nat))))
126125
(f (Wo i))) (f (So i)).

examples/quicksort.v

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ limitations under the License.
1313

1414
From mathcomp Require Import ssreflect ssrbool ssrfun.
1515
From mathcomp Require Import ssrnat eqtype seq path fintype tuple finfun.
16-
From mathcomp Require Import finset fingroup perm.
17-
From mathcomp Require Import interval.
16+
From mathcomp Require Import finset fingroup perm order interval.
1817
From pcm Require Import options axioms prelude seqext pred ordtype slice.
1918
From pcm Require Import pcm unionmap heap.
20-
From htt Require Import options model heapauto.
21-
From htt Require Import array.
22-
From mathcomp Require order.
23-
Import order.Order.NatOrder order.Order.TTheory.
19+
From htt Require Import options model heapauto array.
20+
Import Order.NatOrder Order.TTheory.
2421
Local Open Scope order_scope.
25-
22+
Local Open Scope nat_scope.
2623

2724
(* Brief mathematics of quickorting *)
2825
(* There is some overlap with mathematics developed for bubblesort *)
@@ -150,7 +147,7 @@ Lemma perm_on_fgraph (i : interval nat) (p : 'S_n) (f : {ffun 'I_n -> A}) :
150147
&:(fgraph f ) i.
151148
Proof.
152149
case: i=>i j H.
153-
case/boolP: (order.Order.lt i j)=>[Hij|]; last first.
150+
case/boolP: (Order.lt i j)=>[Hij|]; last first.
154151
- by rewrite -leNgt => H12; rewrite !itv_swapped_bnd.
155152
move: (perm_fgraph p f).
156153
rewrite {1}(slice_extrude (fgraph (pffun p f)) (i:=Interval i j)) //=.
@@ -510,7 +507,7 @@ move: (ltn_ord v); rewrite ltnS leq_eqVlt; case/orP=>[/eqP Ev|Nv].
510507
move: Sl Hpl; rewrite Eh Ev Epr mul1g => Sl Hpl.
511508
rewrite slice_xR; last by rewrite bnd_simp leEnat; move: Hvl; rewrite Ev.
512509
rewrite {22}(_ : n = (ord_max : 'I_n.+1)) // onth_codom /= sorted_rconsE //=.
513-
move: Sl; rewrite slice_oPR /order.Order.lt/= lt0n -{1}Ev Nv0.
510+
move: Sl; rewrite slice_oPR /Order.lt/= lt0n -{1}Ev Nv0.
514511
move=>->; rewrite andbT; move: Al; rewrite Ev.
515512
have ->: pffun (pl * p) f ord_max = pffun p f ord_max.
516513
- rewrite !ffunE permM (out_perm Hpl) // inE negb_and -!ltnNge /=.
@@ -569,7 +566,7 @@ apply/and5P; split=>//.
569566
apply/ordW; move/allP: Ah=>/(_ y); apply.
570567
move: Hy; congr (_ = _); move: y; apply: perm_mem.
571568
by rewrite pffunEM; apply: perm_on_fgraph.
572-
- by rewrite slice_oPR /order.Order.lt/= lt0n Nv0 in Sl.
569+
- by rewrite slice_oPR /Order.lt/= lt0n Nv0 in Sl.
573570
have HS: subpred (ord (pffun p f v)) (oleq (pffun p f v)).
574571
- by move=>z /ordW.
575572
move/(sub_all HS): Ah; congr (_ = _); apply/esym/perm_all.

0 commit comments

Comments
 (0)