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

theorem Th6:
  for s being 0-started State of SCMPDS,I being halt-free shiftable Program
  of SCMPDS, a,x,y be Int_position, i,c be Integer st s.x >= c & (
for t be 0-started State of SCMPDS,Q
 st t.x >= c & t.y=s.y & t.a=s.a & t.DataLoc(s.a,i) > 0
  holds IExec(I,Q,t).a=t.a & I is_closed_on t,Q
   & I is_halting_on t,Q & IExec(I,Q,t).
DataLoc(s.a,i) < t.DataLoc(s.a,i) & IExec(I,Q,t).x >= c
 & IExec(I,Q,t).y=t.y) holds
while>0(a,i,I) is_closed_on s,P & while>0(a,i,I) is_halting_on s,P
 & ( s.DataLoc(s.a,i) > 0
   implies IExec(while>0(a,i,I),P,s)
   =IExec(while>0(a,i,I),P,Initialize IExec(I,P,s)))
proof
  let s be 0-started State of SCMPDS,
      I be halt-free shiftable Program of SCMPDS, a,x,y
  be Int_position, i,c be Integer;
  set b=DataLoc(s.a,i);
  defpred P[set] means ex t be State of SCMPDS st t=$1 & t.x >= c & t.y=s.y;
  consider f be Function of product the_Values_of SCMPDS,NAT such that
A1: for s be State of SCMPDS holds (s.b <= 0 implies f.s =0) & (s.b > 0
  implies f.s=s.b) by SCMPDS_8:5;
  deffunc F(State of SCMPDS) = f.$1;
A2: for t be 0-started State of SCMPDS st P[t] & F(t)=0 holds t.b <= 0 by A1;
  assume
A3: s.x >= c;
A4: P[s] by A3;
  assume
A5: for t be 0-started State of SCMPDS,Q
      st t.x >= c & t.y=s.y & t.a=s.a & t.b > 0
holds IExec(I,Q,t).a=t.a & I is_closed_on t,Q & I is_halting_on t,Q
 & IExec(I,Q,t).b <
  t.b & IExec(I,Q,t).x >= c & IExec(I,Q,t).y=t.y;
A6: now
    let t be 0-started State of SCMPDS, Q;
    assume that
A7: P[t] and
A8: t.a=s.a and
A9: t.b > 0;
    set It=IExec(I,Q,t), t2=Initialize It;
    thus
    IExec(I,Q,t).a=t.a & I is_closed_on t,Q & I is_halting_on t,Q
     by A5,A8,A9,A7;
    thus F(t2) < F(t)
    proof
A10:  F(t)=t.b by A1,A9;
      assume
A11:  F(t2) >= F(t);
      then t2.b > 0 by A1,A9,A10;
      then F(t2)=t2.b by A1
        .=It.b by SCMPDS_5:15;
      hence contradiction by A5,A8,A9,A7,A11,A10;
    end;
    thus P[Initialize It]
    proof
      take v=Initialize It;
      thus v=Initialize It;
      It.x >= c by A5,A8,A9,A7;
      hence v.x >= c by SCMPDS_5:15;
      It.y=t.y by A5,A8,A9,A7;
      hence thesis by A7,SCMPDS_5:15;
    end;
  end;
  while>0(a,i,I) is_closed_on s,P & while>0(a,i,I)
  is_halting_on s,P from SCMPDS_8:sch 3(A2,A4,A6);
  hence while>0(a,i,I) is_closed_on s,P & while>0(a,i,I) is_halting_on s,P;
  assume
A12: s.b > 0;
  IExec(while>0(a,i,I),P,s)
   = IExec(while>0(a,i,I),P,Initialize IExec(I,P,s))
    from SCMPDS_8:sch 4(A12,A2,A4,A6);
  hence thesis;
end;
