let s be State of SCMPDS; :: thesis: for I being Program of SCMPDS
for J being shiftable Program of SCMPDS
for a being Int_position
for k1 being Integer st s . (DataLoc ((s . a),k1)) <= 0 & J is_closed_on s & J is_halting_on s holds
( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s )

let I be Program of SCMPDS; :: thesis: for J being shiftable Program of SCMPDS
for a being Int_position
for k1 being Integer st s . (DataLoc ((s . a),k1)) <= 0 & J is_closed_on s & J is_halting_on s holds
( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s )

let J be shiftable Program of SCMPDS; :: thesis: for a being Int_position
for k1 being Integer st s . (DataLoc ((s . a),k1)) <= 0 & J is_closed_on s & J is_halting_on s holds
( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s )

let a be Int_position ; :: thesis: for k1 being Integer st s . (DataLoc ((s . a),k1)) <= 0 & J is_closed_on s & J is_halting_on s holds
( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s )

let k1 be Integer; :: thesis: ( s . (DataLoc ((s . a),k1)) <= 0 & J is_closed_on s & J is_halting_on s implies ( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s ) )
set b = DataLoc ((s . a),k1);
set pJ = stop J;
set s1 = (Initialize s) +* (stop J);
set IF = if>0 (a,k1,I,J);
set pIF = stop (if>0 (a,k1,I,J));
set s3 = (Initialize s) +* (stop (if>0 (a,k1,I,J)));
set s4 = Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1);
I1: s +* (Initialize (stop J)) = (Initialize s) +* (stop J) by COMPOS_1:125;
I2: s +* (Initialize (stop (if>0 (a,k1,I,J)))) = (Initialize s) +* (stop (if>0 (a,k1,I,J))) by COMPOS_1:125;
set i = (a,k1) <=0_goto ((card I) + 2);
set G = Goto ((card J) + 1);
set iG = (((a,k1) <=0_goto ((card I) + 2)) ';' I) ';' (Goto ((card J) + 1));
A1: if>0 (a,k1,I,J) = (((a,k1) <=0_goto ((card I) + 2)) ';' (I ';' (Goto ((card J) + 1)))) ';' J by SCMPDS_4:50
.= ((a,k1) <=0_goto ((card I) + 2)) ';' ((I ';' (Goto ((card J) + 1))) ';' J) by SCMPDS_4:50 ;
A2: Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),(0 + 1)) = Following ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),0))) by EXTPRO_1:4
.= Following ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J))))) by EXTPRO_1:3
.= Exec (((a,k1) <=0_goto ((card I) + 2)),((Initialize s) +* (stop (if>0 (a,k1,I,J))))) by A1, Th22, I2 ;
A3: not DataLoc ((s . a),k1) in dom (Initialize (stop (if>0 (a,k1,I,J)))) by SCMPDS_4:31;
not a in dom (Initialize (stop (if>0 (a,k1,I,J)))) by SCMPDS_4:31;
then A4: ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) . (DataLoc ((((Initialize s) +* (stop (if>0 (a,k1,I,J)))) . a),k1)) = ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) . (DataLoc ((s . a),k1)) by I2, FUNCT_4:12
.= s . (DataLoc ((s . a),k1)) by A3, I2, FUNCT_4:12 ;
A5: IC ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) = 0 by I2, FUNCT_4:26, SCMPDS_5:18;
assume s . (DataLoc ((s . a),k1)) <= 0 ; :: thesis: ( not J is_closed_on s or not J is_halting_on s or ( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s ) )
then A6: IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) = ICplusConst (((Initialize s) +* (stop (if>0 (a,k1,I,J)))),((card I) + 2)) by A2, A4, SCMPDS_2:68
.= 0 + ((card I) + 2) by A5, Th23 ;
assume A7: J is_closed_on s ; :: thesis: ( not J is_halting_on s or ( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s ) )
then A8: ( Initialize (stop J) c= (Initialize s) +* (stop J) & J is_closed_on (Initialize s) +* (stop J) ) by Th38, I1, FUNCT_4:26;
A9: stop (if>0 (a,k1,I,J)) c= (Initialize s) +* (stop (if>0 (a,k1,I,J))) by FUNCT_4:26;
A10: card ((((a,k1) <=0_goto ((card I) + 2)) ';' I) ';' (Goto ((card J) + 1))) = (card (((a,k1) <=0_goto ((card I) + 2)) ';' I)) + (card (Goto ((card J) + 1))) by AFINSQ_1:20
.= (card (((a,k1) <=0_goto ((card I) + 2)) ';' I)) + 1 by SCMPDS_5:6
.= ((card I) + 1) + 1 by Th15
.= (card I) + (1 + 1) ;
then Shift ((stop J),((card I) + 2)) c= stop (if>0 (a,k1,I,J)) by Th24;
then Shift ((stop J),((card I) + 2)) c= (Initialize s) +* (stop (if>0 (a,k1,I,J))) by A9, XBOOLE_1:1;
then A11: Shift ((stop J),((card I) + 2)) c= Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1) by AMI_1:81;
assume J is_halting_on s ; :: thesis: ( if>0 (a,k1,I,J) is_closed_on s & if>0 (a,k1,I,J) is_halting_on s )
then A12: ProgramPart ((Initialize s) +* (stop J)) halts_on (Initialize s) +* (stop J) by Def3;
A13: DataPart ((Initialize s) +* (stop J)) = DataPart ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) by COMPOS_1:138, FUNCT_7:134;
now
let a be Int_position ; :: thesis: ((Initialize s) +* (stop J)) . a = (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) . a
thus ((Initialize s) +* (stop J)) . a = ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) . a by A13, SCMPDS_4:23
.= (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) . a by A2, SCMPDS_2:68 ; :: thesis: verum
end;
then A14: DataPart ((Initialize s) +* (stop J)) = DataPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) by SCMPDS_4:23;
now
let k be Element of NAT ; :: thesis: IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),b1)) in dom (stop (if>0 (a,k1,I,J)))
per cases ( 0 < k or k = 0 ) ;
suppose 0 < k ; :: thesis: IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),b1)) in dom (stop (if>0 (a,k1,I,J)))
then consider k1 being Nat such that
A15: k1 + 1 = k by NAT_1:6;
reconsider k1 = k1 as Element of NAT by ORDINAL1:def 13;
reconsider m = IC (Comput ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)),k1)) as Element of NAT ;
m in dom (stop J) by A7, Def2;
then m < card (stop J) by AFINSQ_1:70;
then A16: m + ((card I) + 2) < (card (stop J)) + ((card I) + 2) by XREAL_1:8;
A17: card (stop J) = (card J) + 1 by SCMPDS_5:7;
A18: card (stop (if>0 (a,k1,I,J))) = (card (if>0 (a,k1,I,J))) + 1 by SCMPDS_5:7
.= (((card I) + 2) + (card J)) + 1 by A10, AFINSQ_1:20
.= ((card I) + 2) + (card (stop J)) by A17 ;
T: ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) = ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) by AMI_1:123;
IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),k)) = IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)),k1)) by A15, EXTPRO_1:5
.= m + ((card I) + 2) by A8, A14, A11, A6, Th45, T ;
hence IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),k)) in dom (stop (if>0 (a,k1,I,J))) by A18, A16, AFINSQ_1:70; :: thesis: verum
end;
suppose k = 0 ; :: thesis: IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),b1)) in dom (stop (if>0 (a,k1,I,J)))
then Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),k) = (Initialize s) +* (stop (if>0 (a,k1,I,J))) by EXTPRO_1:3;
hence IC (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),k)) in dom (stop (if>0 (a,k1,I,J))) by A5, COMPOS_1:135; :: thesis: verum
end;
end;
end;
hence if>0 (a,k1,I,J) is_closed_on s by Def2; :: thesis: if>0 (a,k1,I,J) is_halting_on s
T: ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) = ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) by AMI_1:123;
x: Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),((LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)))) + 1)) = Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)),(LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J))))) by EXTPRO_1:5;
TX4: ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)) = ProgramPart (Comput ((ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)),(LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)))))) by AMI_1:123;
TX1: ProgramPart ((Initialize s) +* (stop J)) = ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)),(LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)))))) by AMI_1:123;
CurInstr ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),((LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)))) + 1)))) = CurInstr ((ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1))),(Comput ((ProgramPart (Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1))),(Comput ((ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J))))),((Initialize s) +* (stop (if>0 (a,k1,I,J)))),1)),(LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J))))))) by x, T
.= CurInstr ((ProgramPart ((Initialize s) +* (stop J))),(Comput ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J)),(LifeSpan ((ProgramPart ((Initialize s) +* (stop J))),((Initialize s) +* (stop J))))))) by A8, A14, A11, A6, Th45, TX1, TX4
.= halt SCMPDS by A12, EXTPRO_1:def 14 ;
then ProgramPart ((Initialize s) +* (stop (if>0 (a,k1,I,J)))) halts_on (Initialize s) +* (stop (if>0 (a,k1,I,J))) by EXTPRO_1:30;
hence if>0 (a,k1,I,J) is_halting_on s by Def3; :: thesis: verum