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

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

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

let k1 be Integer; :: thesis: ( s . (DataLoc (s . a),k1) = 0 implies ( if<>0 a,k1,I is_closed_on s & if<>0 a,k1,I is_halting_on s ) )
set b = DataLoc (s . a),k1;
assume A1: s . (DataLoc (s . a),k1) = 0 ; :: thesis: ( if<>0 a,k1,I is_closed_on s & if<>0 a,k1,I is_halting_on s )
set IF = if<>0 a,k1,I;
set pIF = stop (if<>0 a,k1,I);
set s3 = (Initialize s) +* (stop (if<>0 a,k1,I));
set s4 = Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1;
set s5 = Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2;
I1: s +* (Initialize (stop (if<>0 a,k1,I))) = (Initialize s) +* (stop (if<>0 a,k1,I)) by SCMPDS_4:5;
A2: not DataLoc (s . a),k1 in dom (Initialize (stop (if<>0 a,k1,I))) by SCMPDS_4:31;
not a in dom (Initialize (stop (if<>0 a,k1,I))) by SCMPDS_4:31;
then A3: ((Initialize s) +* (stop (if<>0 a,k1,I))) . (DataLoc (((Initialize s) +* (stop (if<>0 a,k1,I))) . a),k1) = ((Initialize s) +* (stop (if<>0 a,k1,I))) . (DataLoc (s . a),k1) by I1, FUNCT_4:12
.= 0 by A1, A2, I1, FUNCT_4:12 ;
A4: Initialize (stop (if<>0 a,k1,I)) c= (Initialize s) +* (stop (if<>0 a,k1,I)) by I1, FUNCT_4:26;
then A5: stop (if<>0 a,k1,I) c= Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1 by AMI_1:81, SCMPDS_4:57;
set i = a,k1 <>0_goto 2;
set j = goto ((card I) + 1);
A6: if<>0 a,k1,I = (a,k1 <>0_goto 2) ';' ((goto ((card I) + 1)) ';' I) by SCMPDS_4:52;
A7: IC ((Initialize s) +* (stop (if<>0 a,k1,I))) = 0 by I1, FUNCT_4:26, SCMPDS_5:18;
Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),(0 + 1) = Following (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),(Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),0 ) by AMI_1:14
.= Following (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))) by AMI_1:13
.= Exec (a,k1 <>0_goto 2),((Initialize s) +* (stop (if<>0 a,k1,I))) by A6, Th22, I1 ;
then A8: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) = succ (IC ((Initialize s) +* (stop (if<>0 a,k1,I)))) by A3, SCMPDS_2:67
.= 0 + 1 by A7 ;
A9: 1 in dom (if<>0 a,k1,I) by Lm9;
then 1 in dom (stop (if<>0 a,k1,I)) by Th18;
then A10: (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) . 1 = (stop (if<>0 a,k1,I)) . 1 by A5, GRFUNC_1:8
.= (if<>0 a,k1,I) . 1 by A9, Th19
.= goto ((card I) + 1) by Lm10 ;
A11: card (if<>0 a,k1,I) = (card I) + 2 by Lm8;
then A12: (card I) + 2 in dom (stop (if<>0 a,k1,I)) by Th25;
Y: (ProgramPart (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1)) /. (IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1)) = (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) . (IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1)) by COMPOS_1:38;
T: ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I))) = ProgramPart (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) by AMI_1:123;
Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),(1 + 1) = Following (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),(Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) by AMI_1:14
.= Exec (goto ((card I) + 1)),(Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1) by A8, A10, Y, T ;
then A13: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2) = ICplusConst (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),1),((card I) + 1) by SCMPDS_2:66
.= ((card I) + 1) + 1 by A8, Th23
.= (card I) + (1 + 1) ;
Y: (ProgramPart (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2)) /. (IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2)) = (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2) . (IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2)) by COMPOS_1:38;
TX: ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I))) = ProgramPart (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2) by AMI_1:123;
stop (if<>0 a,k1,I) c= Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2 by A4, AMI_1:81, SCMPDS_4:57;
then (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2) . ((card I) + 2) = (stop (if<>0 a,k1,I)) . ((card I) + 2) by A12, GRFUNC_1:8
.= halt SCMPDS by A11, Th25 ;
then A14: CurInstr (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),(Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),2) = halt SCMPDS by A13, Y, TX;
now
let k be Element of NAT ; :: thesis: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),b1) in dom (stop (if<>0 a,k1,I))
A15: ( k = 0 or 0 + 1 <= k ) by INT_1:20;
per cases ( k = 0 or k = 1 or 1 < k ) by A15, XXREAL_0:1;
suppose k = 0 ; :: thesis: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),b1) in dom (stop (if<>0 a,k1,I))
then Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),k = (Initialize s) +* (stop (if<>0 a,k1,I)) by AMI_1:13;
hence IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),k) in dom (stop (if<>0 a,k1,I)) by A7, SCMPDS_4:75; :: thesis: verum
end;
suppose k = 1 ; :: thesis: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),b1) in dom (stop (if<>0 a,k1,I))
hence IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),k) in dom (stop (if<>0 a,k1,I)) by A9, A8, Th18; :: thesis: verum
end;
suppose 1 < k ; :: thesis: IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),b1) in dom (stop (if<>0 a,k1,I))
then 1 + 1 <= k by INT_1:20;
hence IC (Comput (ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I)))),((Initialize s) +* (stop (if<>0 a,k1,I))),k) in dom (stop (if<>0 a,k1,I)) by A12, A13, A14, AMI_1:52; :: thesis: verum
end;
end;
end;
hence if<>0 a,k1,I is_closed_on s by Def2; :: thesis: if<>0 a,k1,I is_halting_on s
ProgramPart ((Initialize s) +* (stop (if<>0 a,k1,I))) halts_on (Initialize s) +* (stop (if<>0 a,k1,I)) by A14, AMI_1:146;
hence if<>0 a,k1,I is_halting_on s by Def3; :: thesis: verum