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

theorem
  p0 >= 7 implies insert-sort (n,p0) is parahalting
proof
  set a=GBP, i1= a:=0, i2= (a,1):=0, i3= (a,2):=(n-1), i4= (a,3):=p0, I= i1
  ';' i2 ';' i3 ';' i4;
  assume
A1: p0 >= 7;
  now
    let s be State of SCMPDS;
    let P;
    set s1=IExec(I,P,Initialize s),
    s2=IExec(i1 ';' i2 ';' i3,P,Initialize s), P1 = P,
    s3=IExec(i1 ';' i2,P,Initialize s), s4
    =Exec(i1, Initialize s);
A2: s1.a = (Initialize s1).a by SCMPDS_5:15;
A3: s1.a1 = (Initialize s1).a1 by SCMPDS_5:15;
A4: s1.a3 = (Initialize s1).a3 by SCMPDS_5:15;
A5: I is_closed_on s,P & I is_halting_on s,P by SCMPDS_6:20,21;
A6: s4.a=0 by SCMPDS_2:45;
    then
A7: DataLoc(s4.a,1)=intpos (0+1) by SCMP_GCD:1;
A8: s3.a=Exec(i2,s4).a by SCMPDS_5:42
      .=0 by A6,A7,AMI_3:10,SCMPDS_2:46;
    then
A9: DataLoc(s3.a,2)=intpos (0+2) by SCMP_GCD:1;
A10: s3.a1=Exec(i2,s4).a1 by SCMPDS_5:42
      .=0 by A7,SCMPDS_2:46;
A11: s2.a1=Exec(i3,s3).a1 by SCMPDS_5:41
      .=0 by A10,A9,AMI_3:10,SCMPDS_2:46;
A12: s2.a=Exec(i3,s3).a by SCMPDS_5:41
      .=0 by A8,A9,AMI_3:10,SCMPDS_2:46;
    then
A13: DataLoc(s2.a,3)=intpos (0+3) by SCMP_GCD:1;
A14: s1.a3=Exec(i4,s2).a3 by SCMPDS_5:41
      .=p0 by A13,SCMPDS_2:46;
    s1.a1=Exec(i4,s2).a1 by SCMPDS_5:41
      .=0 by A11,A13,AMI_3:10,SCMPDS_2:46;
    then
A15: s1.a3 >= s1.a1+7 by A1,A14;
    s1.a=Exec(i4,s2).a by SCMPDS_5:41
      .=0 by A12,A13,AMI_3:10,SCMPDS_2:46;
    then FR is_closed_on Initialize s1,P1 & FR is_halting_on Initialize s1,P1
        by A15,Lm12,A2,A3,A4;
    then FR is_closed_on s1,P1 & FR is_halting_on s1,P1 by SCMPDS_6:125,126;
    hence insert-sort (n,p0) is_halting_on s,P by A5,SCMPDS_7:24;
  end;
  hence thesis by SCMPDS_6:21;
end;
