:: SCPISORT semantic presentation
:: deftheorem Def1 defines is_FinSequence_on SCPISORT:def 1 :
Lemma2:
for b1 being FinSequence of INT
for b2 being Nat holds b1 is_non_decreasing_on b2,b2
theorem Th1: :: SCPISORT:1
theorem Th2: :: SCPISORT:2
theorem Th3: :: SCPISORT:3
theorem Th4: :: SCPISORT:4
set c1 = the Instruction-Locations of SCMPDS ;
set c2 = SCM-Data-Loc ;
theorem Th5: :: SCPISORT:5
theorem Th6: :: SCPISORT:6
theorem Th7: :: SCPISORT:7
theorem Th8: :: SCPISORT:8
theorem Th9: :: SCPISORT:9
theorem Th10: :: SCPISORT:10
theorem Th11: :: SCPISORT:11
Lemma8:
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds card (stop (for-down b1,b2,b3,b4)) = (card b4) + 4
Lemma9:
for b1 being Int_position
for b2 being Integer
for b3 being Nat
for b4 being Program-block holds for-down b1,b2,b3,b4 = (b1,b2 <=0_goto ((card b4) + 3)) ';' ((b4 ';' (AddTo b1,b2,(- b3))) ';' (goto (- ((card b4) + 2))))
Lemma10:
for b1 being Program-block
for b2 being Int_position
for b3 being Integer
for b4 being Nat holds Shift (b1 ';' (AddTo b2,b3,(- b4))),1 c= for-down b2,b3,b4,b1
scheme :: SCPISORT:sch 1
s1{ P
1[
set ], F
1()
-> State of
SCMPDS , F
2()
-> shiftable No-StopCode Program-block, F
3()
-> Int_position , F
4()
-> Integer, F
5()
-> Nat } :
provided
E11:
F
5()
> 0
and
E12:
P
1[
Dstate F
1()]
and
E13:
for b
1 being
State of
SCMPDS holds
( P
1[
Dstate b
1] & b
1 . F
3()
= F
1()
. F
3() & b
1 . (DataLoc (F1() . F3()),F4()) > 0 implies (
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . F
3()
= b
1 . F
3() &
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . (DataLoc (F1() . F3()),F4()) = (b1 . (DataLoc (F1() . F3()),F4())) - F
5() & F
2()
is_closed_on b
1 & F
2()
is_halting_on b
1 & P
1[
Dstate (IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1)] ) )
scheme :: SCPISORT:sch 2
s2{ P
1[
set ], F
1()
-> State of
SCMPDS , F
2()
-> shiftable No-StopCode Program-block, F
3()
-> Int_position , F
4()
-> Integer, F
5()
-> Nat } :
( not ( not P
1[F
1()] & P
1[F
1()] ) &
IExec (for-down F3(),F4(),F5(),F2()),F
1()
= IExec (for-down F3(),F4(),F5(),F2()),
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),F1()) )
provided
E11:
F
5()
> 0
and
E12:
F
1()
. (DataLoc (F1() . F3()),F4()) > 0
and
E13:
P
1[
Dstate F
1()]
and
E14:
for b
1 being
State of
SCMPDS holds
( P
1[
Dstate b
1] & b
1 . F
3()
= F
1()
. F
3() & b
1 . (DataLoc (F1() . F3()),F4()) > 0 implies (
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . F
3()
= b
1 . F
3() &
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . (DataLoc (F1() . F3()),F4()) = (b1 . (DataLoc (F1() . F3()),F4())) - F
5() & F
2()
is_closed_on b
1 & F
2()
is_halting_on b
1 & P
1[
Dstate (IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1)] ) )
scheme :: SCPISORT:sch 3
s3{ P
1[
set ], F
1()
-> State of
SCMPDS , F
2()
-> shiftable No-StopCode Program-block, F
3()
-> Int_position , F
4()
-> Integer, F
5()
-> Nat } :
provided
E11:
F
5()
> 0
and
E12:
P
1[
Dstate F
1()]
and
E13:
for b
1 being
State of
SCMPDS holds
( P
1[
Dstate b
1] & b
1 . F
3()
= F
1()
. F
3() & b
1 . (DataLoc (F1() . F3()),F4()) > 0 implies (
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . F
3()
= b
1 . F
3() &
(IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1) . (DataLoc (F1() . F3()),F4()) = (b1 . (DataLoc (F1() . F3()),F4())) - F
5() & F
2()
is_closed_on b
1 & F
2()
is_halting_on b
1 & P
1[
Dstate (IExec (F2() ';' (AddTo F3(),F4(),(- F5()))),b1)] ) )
theorem Th12: :: SCPISORT:12
for b
1 being
State of
SCMPDS for b
2 being
shiftable No-StopCode Program-blockfor b
3, b
4, b
5 being
Int_position for b
6, b
7 being
Integerfor b
8 being
Nat holds
( b
8 > 0 & b
1 . b
4 >= (b1 . b5) + b
7 & ( for b
9 being
State of
SCMPDS holds
( b
9 . b
4 >= (b9 . b5) + b
7 & b
9 . b
3 = b
1 . b
3 & b
9 . (DataLoc (b1 . b3),b6) > 0 implies (
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b
3 = b
9 . b
3 &
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . (DataLoc (b1 . b3),b6) = (b9 . (DataLoc (b1 . b3),b6)) - b
8 & b
2 is_closed_on b
9 & b
2 is_halting_on b
9 &
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b
4 >= ((IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b5) + b
7 ) ) ) implies (
for-down b
3,b
6,b
8,b
2 is_closed_on b
1 &
for-down b
3,b
6,b
8,b
2 is_halting_on b
1 ) )
theorem Th13: :: SCPISORT:13
for b
1 being
State of
SCMPDS for b
2 being
shiftable No-StopCode Program-blockfor b
3, b
4, b
5 being
Int_position for b
6, b
7 being
Integerfor b
8 being
Nat holds
( b
8 > 0 & b
1 . b
4 >= (b1 . b5) + b
7 & b
1 . (DataLoc (b1 . b3),b6) > 0 & ( for b
9 being
State of
SCMPDS holds
( b
9 . b
4 >= (b9 . b5) + b
7 & b
9 . b
3 = b
1 . b
3 & b
9 . (DataLoc (b1 . b3),b6) > 0 implies (
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b
3 = b
9 . b
3 &
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . (DataLoc (b1 . b3),b6) = (b9 . (DataLoc (b1 . b3),b6)) - b
8 & b
2 is_closed_on b
9 & b
2 is_halting_on b
9 &
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b
4 >= ((IExec (b2 ';' (AddTo b3,b6,(- b8))),b9) . b5) + b
7 ) ) ) implies
IExec (for-down b3,b6,b8,b2),b
1 = IExec (for-down b3,b6,b8,b2),
(IExec (b2 ';' (AddTo b3,b6,(- b8))),b1) )
theorem Th14: :: SCPISORT:14
for b
1 being
State of
SCMPDS for b
2 being
shiftable No-StopCode Program-blockfor b
3 being
Int_position for b
4 being
Integerfor b
5 being
Nat holds
( b
1 . (DataLoc (b1 . b3),b4) > 0 & b
5 > 0 &
card b
2 > 0 & b
3 <> DataLoc (b1 . b3),b
4 & ( for b
6 being
State of
SCMPDS holds
( b
6 . b
3 = b
1 . b
3 implies (
(IExec b2,b6) . b
3 = b
6 . b
3 &
(IExec b2,b6) . (DataLoc (b1 . b3),b4) = b
6 . (DataLoc (b1 . b3),b4) & b
2 is_closed_on b
6 & b
2 is_halting_on b
6 ) ) ) implies (
for-down b
3,b
4,b
5,b
2 is_closed_on b
1 &
for-down b
3,b
4,b
5,b
2 is_halting_on b
1 ) )
definition
let c
3, c
4 be
Nat;
func insert-sort c
1,c
2 -> Program-block equals :: SCPISORT:def 2
((((GBP := 0) ';' (GBP ,1 := 0)) ';' (GBP ,2 := (a1 - 1))) ';' (GBP ,3 := a2)) ';' (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))));
coherence
((((GBP := 0) ';' (GBP ,1 := 0)) ';' (GBP ,2 := (c3 - 1))) ';' (GBP ,3 := c4)) ';' (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))))) is Program-block
;
end;
:: deftheorem Def2 defines insert-sort SCPISORT:def 2 :
for b
1, b
2 being
Nat holds
insert-sort b
1,b
2 = ((((GBP := 0) ';' (GBP ,1 := 0)) ';' (GBP ,2 := (b1 - 1))) ';' (GBP ,3 := b2)) ';' (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))));
set c3 = AddTo GBP ,3,1;
set c4 = GBP ,4 := GBP ,3;
set c5 = AddTo GBP ,1,1;
set c6 = GBP ,6 := GBP ,1;
set c7 = GBP ,5 := (intpos 4),(- 1);
set c8 = SubFrom GBP ,5,(intpos 4),0;
set c9 = GBP ,5 := (intpos 4),(- 1);
set c10 = (intpos 4),(- 1) := (intpos 4),0;
set c11 = (intpos 4),0 := GBP ,5;
set c12 = AddTo GBP ,4,(- 1);
set c13 = AddTo GBP ,6,(- 1);
set c14 = Load (GBP ,6 := 0);
set c15 = ((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1));
set c16 = if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0));
set c17 = ((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)));
set c18 = while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))));
set c19 = (((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1);
set c20 = ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))));
set c21 = for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))));
Lemma13:
card (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))) = 10
Lemma14:
card (((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) = 16
set c22 = intpos 1;
set c23 = intpos 2;
set c24 = intpos 3;
set c25 = intpos 4;
set c26 = intpos 5;
set c27 = intpos 6;
Lemma15:
for b1 being State of SCMPDS holds
( b1 . (intpos 4) >= 7 + (b1 . (intpos 6)) & b1 . GBP = 0 & b1 . (intpos 6) > 0 implies ( (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . GBP = 0 & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 1) = b1 . (intpos 1) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 2) = b1 . (intpos 2) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 3) = b1 . (intpos 3) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 6) < b1 . (intpos 6) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 4) >= 7 + ((IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 6)) & ( for b2 being Nat holds
( b2 >= 7 & b2 <> (b1 . (intpos 4)) - 1 & b2 <> b1 . (intpos 4) implies (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos b2) = b1 . (intpos b2) ) ) & ( b1 . (DataLoc (b1 . (intpos 4)),(- 1)) > b1 . (DataLoc (b1 . (intpos 4)),0) implies ( (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (DataLoc (b1 . (intpos 4)),(- 1)) = b1 . (DataLoc (b1 . (intpos 4)),0) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (DataLoc (b1 . (intpos 4)),0) = b1 . (DataLoc (b1 . (intpos 4)),(- 1)) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 6) = (b1 . (intpos 6)) - 1 & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 4) = (b1 . (intpos 4)) - 1 ) ) & ( b1 . (DataLoc (b1 . (intpos 4)),(- 1)) <= b1 . (DataLoc (b1 . (intpos 4)),0) implies ( (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (DataLoc (b1 . (intpos 4)),(- 1)) = b1 . (DataLoc (b1 . (intpos 4)),(- 1)) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (DataLoc (b1 . (intpos 4)),0) = b1 . (DataLoc (b1 . (intpos 4)),0) & (IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) . (intpos 6) = 0 ) ) ) )
Lemma16:
for b1 being State of SCMPDS holds
( b1 . (intpos 4) >= 7 + (b1 . (DataLoc (b1 . GBP ),6)) & b1 . GBP = 0 implies ( while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))) is_closed_on b1 & while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))) is_halting_on b1 ) )
Lemma17:
for b1 being State of SCMPDS holds
( b1 . (intpos 4) >= 7 + (b1 . (DataLoc (b1 . GBP ),6)) & b1 . GBP = 0 implies ( (IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b1) . GBP = 0 & (IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b1) . (intpos 1) = b1 . (intpos 1) & (IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b1) . (intpos 2) = b1 . (intpos 2) & (IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b1) . (intpos 3) = b1 . (intpos 3) ) )
Lemma18:
for b1 being State of SCMPDS holds
( b1 . GBP = 0 implies ( (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . GBP = 0 & (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos 1) = (b1 . (intpos 1)) + 1 & (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos 2) = b1 . (intpos 2) & (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos 3) = (b1 . (intpos 3)) + 1 & (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos 4) = (b1 . (intpos 3)) + 1 & (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos 6) = (b1 . (intpos 1)) + 1 & ( for b2 being Nat holds
( b2 >= 7 implies (IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1) . (intpos b2) = b1 . (intpos b2) ) ) ) )
set c28 = AddTo GBP ,2,(- 1);
set c29 = (((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1));
Lemma19:
for b1 being State of SCMPDS holds
( b1 . (intpos 3) >= (b1 . (intpos 1)) + 7 & b1 . GBP = 0 implies ( (IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) . GBP = 0 & (IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) . (intpos 2) = (b1 . (intpos 2)) - 1 & (IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) . (intpos 3) = (b1 . (intpos 3)) + 1 & (IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) . (intpos 1) = (b1 . (intpos 1)) + 1 & ( for b2 being Nat holds
( b2 <> 2 implies (IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) . (intpos b2) = (IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),(IExec ((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)),b1)) . (intpos b2) ) ) ) )
Lemma20:
for b1 being State of SCMPDS holds
( b1 . (intpos 3) >= (b1 . (intpos 1)) + 7 & b1 . GBP = 0 implies ( for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) is_closed_on b1 & for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) is_halting_on b1 ) )
Lemma21:
for b1 being State of SCMPDS holds
( b1 . (intpos 3) >= (b1 . (intpos 1)) + 7 & b1 . GBP = 0 & b1 . (intpos 2) > 0 implies IExec (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))))),b1 = IExec (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))))),(IExec ((((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))))) ';' (AddTo GBP ,2,(- 1))),b1) )
theorem Th15: :: SCPISORT:15
theorem Th16: :: SCPISORT:16
Lemma22:
for b1 being State of SCMPDS holds
( b1 . (intpos 4) >= 7 + (b1 . (intpos 6)) & b1 . GBP = 0 & b1 . (intpos 6) > 0 implies IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b1 = IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),(IExec (((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0)))),b1) )
set c30 = while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))));
theorem Th17: :: SCPISORT:17
for b
1 being
State of
SCMPDS for b
2, b
3 being
FinSequence of
INT for b
4, b
5 being
Nat holds
( b
1 . (intpos 4) >= 7
+ (b1 . (intpos 6)) & b
1 . GBP = 0 & b
5 = b
1 . (intpos 6) & b
4 = ((b1 . (intpos 4)) - (b1 . (intpos 6))) - 1 & b
2 is_FinSequence_on b
1,b
4 & b
3 is_FinSequence_on IExec (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))),b
1,b
4 &
len b
2 = len b
3 &
len b
2 > b
5 & b
2 is_non_decreasing_on 1,b
5 implies ( b
2,b
3 are_fiberwise_equipotent & b
3 is_non_decreasing_on 1,b
5 + 1 & ( for b
6 being
Nat holds
( b
6 > b
5 + 1 & b
6 <= len b
2 implies b
2 . b
6 = b
3 . b
6 ) ) & ( for b
6 being
Nat holds
not ( 1
<= b
6 & b
6 <= b
5 + 1 & ( for b
7 being
Nat holds
not ( 1
<= b
7 & b
7 <= b
5 + 1 & b
3 . b
6 = b
2 . b
7 ) ) ) ) ) )
Lemma24:
for b1 being State of SCMPDS
for b2, b3 being FinSequence of INT
for b4, b5 being Nat holds
( b1 . GBP = 0 & b1 . (intpos 2) = b5 - 1 & b1 . (intpos 3) = b4 + 1 & b1 . (intpos 1) = 0 & b4 >= 6 & b2 is_FinSequence_on b1,b4 & b3 is_FinSequence_on IExec (for-down GBP ,2,1,(((((AddTo GBP ,3,1) ';' (GBP ,4 := GBP ,3)) ';' (AddTo GBP ,1,1)) ';' (GBP ,6 := GBP ,1)) ';' (while>0 GBP ,6,(((GBP ,5 := (intpos 4),(- 1)) ';' (SubFrom GBP ,5,(intpos 4),0)) ';' (if>0 GBP ,5,(((((GBP ,5 := (intpos 4),(- 1)) ';' ((intpos 4),(- 1) := (intpos 4),0)) ';' ((intpos 4),0 := GBP ,5)) ';' (AddTo GBP ,4,(- 1))) ';' (AddTo GBP ,6,(- 1))),(Load (GBP ,6 := 0))))))),b1,b4 & len b2 = b5 & len b3 = b5 implies ( b2,b3 are_fiberwise_equipotent & b3 is_non_decreasing_on 1,b5 ) )
theorem Th18: :: SCPISORT:18