Thm* L:T List, P:(T![](FONT/dash.png) T![](FONT/dash.png) Prop).
Thm* ( x,y:T. Dec(P(x,y)))
Thm* ![](FONT/eq.png)
Thm* ( x,y:T. P(x,y) ![](FONT/eq.png) P(y,x))
Thm* ![](FONT/eq.png)
Thm* ( L':T List.
Thm* ((L (swap adjacent[ P(x,y)]^*) L') & ( i: (||L'||-1). P(L'[i],L'[(i+1)]))) | [partial_sort] |
Thm* L:T List, P:(T![](FONT/dash.png) T![](FONT/dash.png) ![](FONT/then_med.png) ).
Thm* ( x,y:T. P(x,y) ![](FONT/eq.png) P(y,x))
Thm* ![](FONT/eq.png)
Thm* ( L':T List.
Thm* ((L guarded_permutation(T; L,i. P(L[i],L[(i+1)])) L')
Thm* (& ( i: (||L'||-1). P(L'[i],L'[(i+1)]))) | [partial_sort_exists_2] |
Thm* R:(T![](FONT/dash.png) T![](FONT/dash.png) Prop), k: , x,y:T.
Thm* (x R^k y)
Thm* ![](FONT/if_big.png)
Thm* ( L:T List.
Thm* (||L|| = k+1 & L[0] = x & last(L) = y & ( i: k. L[i] R L[(i+1)])) | [rel_exp_list] |
Thm* P:(L:(T List)![](FONT/dash.png) ![](FONT/then_med.png) (||L||-1)![](FONT/dash.png) ![](FONT/then_med.png) ), m:((T List)![](FONT/dash.png) ![](FONT/then_med.png) ).
Thm* ( L:T List, i: (||L||-1).
Thm* (P(L,i) ![](FONT/eq.png) P(swap(L;i;i+1),i) & m(swap(L;i;i+1))<m(L))
Thm* ![](FONT/eq.png)
Thm* ( L:T List.
Thm* ( L':T List.
Thm* ((L guarded_permutation(T; L,i. P(L,i)) L') & ( i: (||L'||-1). P(L',i))) | [partial_sort_exists] |
Thm* L:T List, i: (||L||-1), a,b:T.
Thm* a before b swap(L;i;i+1) ![](FONT/eq.png) a before b L a = L[(i+1)] & b = L[i] | [l_before_swap] |
Thm* i: , L:A List.
Thm* i+1<||L||
Thm* ![](FONT/eq.png)
Thm* ( X,Y:A List.
Thm* (L = (X @ [L[i]; L[(i+1)]] @ Y)
Thm* (& swap(L;i;i+1) = (X @ [L[(i+1)]; L[i]] @ Y)) | [swap_adjacent_decomp] |
Thm* L1,L2:T List, i,j: ||L1||.
Thm* L2 = swap(L1;i;j)
Thm* ![](FONT/eq.png)
Thm* L2[i] = L1[j] & L2[j] = L1[i] & ||L2|| = ||L1|| & L1 = swap(L2;i;j)
Thm* & ( x: ||L2||. x = i ![](FONT/eq.png) x = j ![](FONT/eq.png) L2[x] = L1[x]) | [swapped_select] |
Thm* L:T List, P:( ||L||![](FONT/dash.png) Prop).
Thm* ( x: ||L||. Dec(P(x)))
Thm* ![](FONT/eq.png)
Thm* ( i: ||L||. P(i)) ![](FONT/eq.png) ( i: ||L||. P(i) & ( j: ||L||. i<j ![](FONT/eq.png) P(j))) | [last_with_property] |
Thm* L:T List, P:( ||L||![](FONT/dash.png) Prop).
Thm* ( x: ||L||. Dec(P(x)))
Thm* ![](FONT/eq.png)
Thm* ( L1,L2:T List, f1:( ||L1||![](FONT/dash.png) ![](FONT/then_med.png) ||L||), f2:( ||L2||![](FONT/dash.png) ![](FONT/then_med.png) ||L||).
Thm* (interleaving_occurence(T;L1;L2;L;f1;f2)
Thm* (& ( i: ||L1||. P(f1(i))) & ( i: ||L2||. P(f2(i)))
Thm* (& ( i: ||L||.
Thm* (& ((P(i) ![](FONT/eq.png) ( j: ||L1||. f1(j) = i))
Thm* (& (& ( P(i) ![](FONT/eq.png) ( j: ||L2||. f2(j) = i)))) | [interleaving_split] |
Thm* L1,L2,L:T List. disjoint_sublists(T;L1;L2;L) ![](FONT/eq.png) L1 L & L2 L | [disjoint_sublists_sublist] |
Thm* P:(T![](FONT/dash.png) ![](FONT/then_med.png) ), T':Type, f:({x:T| P(x) }![](FONT/dash.png) T'), L:T List, x:T'.
Thm* (x mapfilter(f;P;L)) ![](FONT/if_big.png) ( y:T. (y L) & P(y) & x = f(y)) | [member_map_filter] |
Thm* l:T List, P:(T![](FONT/dash.png) ![](FONT/then_med.png) ), x,y:T.
Thm* x before y filter(P;l) ![](FONT/if_big.png) P(x) & P(y) & x before y l | [l_before_filter] |
Thm* L1,L2:T List, P:(T![](FONT/dash.png) ![](FONT/then_med.png) ). L2 filter(P;L1) ![](FONT/if_big.png) L2 L1 & ( x L2.P(x)) | [sublist_filter] |
Thm* P:(T![](FONT/dash.png) Prop), x:T, L:T List. ( y [x / L].P(y)) ![](FONT/if_big.png) P(x) & ( y L.P(y)) | [l_all_cons] |
Def swap adjacent[P(x;y)](L1,L2)
Def == i: (||L1||-1). P(L1[i];L1[(i+1)]) & L2 = swap(L1;i;i+1) A List | [swap_adjacent] |
Def guarded_permutation(T;P)
Def == ( L1,L2. i: (||L1||-1). P(L1,i) & L2 = swap(L1;i;i+1) T List)^* | [guarded_permutation] |
Def interleaving_occurence(T;L1;L2;L;f1;f2)
Def == ||L|| = ||L1||+||L2||
Def == & increasing(f1;||L1||) & ( j: ||L1||. L1[j] = L[(f1(j))] T)
Def == & increasing(f2;||L2||) & ( j: ||L2||. L2[j] = L[(f2(j))] T)
Def == & ( j1: ||L1||, j2: ||L2||. f1(j1) = f2(j2) ) | [interleaving_occurence] |
Def interleaving(T;L1;L2;L)
Def == ||L|| = ||L1||+||L2|| & disjoint_sublists(T;L1;L2;L) | [interleaving] |
Def disjoint_sublists(T;L1;L2;L)
Def == f1:( ||L1||![](FONT/dash.png) ![](FONT/then_med.png) ||L||), f2:( ||L2||![](FONT/dash.png) ![](FONT/then_med.png) ||L||).
Def == increasing(f1;||L1||) & ( j: ||L1||. L1[j] = L[(f1(j))] T)
Def == & increasing(f2;||L2||) & ( j: ||L2||. L2[j] = L[(f2(j))] T)
Def == & ( j1: ||L1||, j2: ||L2||. f1(j1) = f2(j2)) | [disjoint_sublists] |
Def sublist_occurence(T;L1;L2;f)
Def == increasing(f;||L1||) & ( j: ||L1||. L1[j] = L2[(f(j))] T) | [sublist_occurence] |
Def ( x L.P(x)) == x:T. (x L) & P(x) | [l_exists] |
Def l_disjoint(T;l1;l2) == x:T. ((x l1) & (x l2)) | [l_disjoint] |