reserve x for Int_position,
  n,p0 for Nat;
reserve P,Q,V for Instruction-Sequence of SCMPDS;

theorem Th10:
  for s be 0-started State of SCMPDS,
  md,p0 be Nat st s.GBP=0 & s.
  intpos 2=md & md >= p0+1 & p0 >= 7 holds Partition is_closed_on s,P
   & Partition
  is_halting_on s,P
proof
  set KW=K4 ';' WH3;
  let s be 0-started State of SCMPDS,md,n0 be Nat;
  set s2=IExec(K4,P,Initialize s), a=GBP, P2 = P;
  assume that
A1: s.a=0 and
A2: s.a2=md and
A3: md >= n0+1 and
A4: n0 >= 7;
A5: s2.a2=s.a2 by A1,Lm27;
  set m3=md;
  s2.a5=s.a4-s.a2 by A1,Lm27;
  then
A6: s2.a4=m3+s2.a5 by A1,A2,Lm27;
  s2.a3=s.a2+1 by A1,Lm27;
  then
A7: s.a2=s2.a3-1;
A8: s2.a=0 by A1,Lm27;

A9: (Initialize s2).GBP = s2.GBP by SCMPDS_5:15;
A10: (Initialize s2).a2 = s2.a2 by SCMPDS_5:15;
A11: (Initialize s2).a3 = s2.a3 by SCMPDS_5:15;
A12: (Initialize s2).a4 = s2.a4 by SCMPDS_5:15;
A13: (Initialize s2).a5 = s2.a5 by SCMPDS_5:15;
A14: WH3 is_halting_on Initialize s2,P2 by A2,A3,A4,A5,A7,A6,Lm26,A8,A9,A10,A11
,A12
,A13;
A15: WH3 is_halting_on s2,P2
     proof
       P+*stop WH3 halts_on Initialize Initialize s2 by A14,SCMPDS_6:def 3;
      hence thesis by SCMPDS_6:def 3;
     end;
A16: WH3 is_closed_on Initialize s2,P2 by A2,A3,A4,A8,A5,A7,A6,Lm26,A9,A10,A11,
A12
,A13;
A17: WH3 is_closed_on s2,P2
      proof
  for k being Nat holds
   IC Comput(P+*stop WH3,Initialize Initialize s2,k) in dom stop WH3
                   by A16,SCMPDS_6:def 2;
       hence thesis by SCMPDS_6:def 2;
      end;
  then
A18: KW is_closed_on s,P by A15,SCPISORT:9;
A19: KW is_halting_on s,P by A17,A15,SCPISORT:9;
  then
A20: KW ';' j8 is_closed_on s,P by A18,SCPISORT:10;
A21: KW ';' j8 is_halting_on s,P by A18,A19,SCPISORT:10;
  then
A22: KW ';' j8 ';' j9 is_halting_on s,P by A20,SCPISORT:10;
  KW ';' j8 ';' j9 is_closed_on s,P by A20,A21,SCPISORT:10;
  hence thesis by A22,SCPISORT:10;
end;
