reserve n,i,j,k for Nat;
reserve T for TuringStr,
  s for All-State of T;

theorem Th34:
  for s being All-State of ZeroTuring, t be Tape of ZeroTuring,
head be Element of NAT, f be FinSequence of NAT st len f >= 1 & s=[0,head,t] &
t storeData <*head*>^f holds s is Accept-Halt &
 (Result s)`2_3=head & (Result s)
  `3_3 storeData <*head,0*>
proof
  reconsider F=0 as Symbol of ZeroTuring by Lm9;
  let s be All-State of ZeroTuring, t be Tape of ZeroTuring, h be Element of
  NAT, f be FinSequence of NAT;
  assume that
A1: len f >= 1 and
A2: s=[0,h,t] and
A3: t storeData <*h*>^f;
  reconsider s3=s`3_3 as Tape of ZeroTuring;
  reconsider h1=h+1 as Element of INT by INT_1:def 2;
  set m=f/.1, n=h+f/.1+2;
A4: h < h1 by XREAL_1:29;
  reconsider p1=1 as State of ZeroTuring by Lm8;
  set s1= [p1,h1,t];
  reconsider i2=h1+1 as Element of INT by INT_1:def 2;
A5: h1 < i2 by XREAL_1:29;
  reconsider T=1 as Symbol of ZeroTuring by Lm9;
  set t1=Tape-Chg(t,h1,T);
  set t2=Tape-Chg(t1,i2,F);
  set t3=Tape-Chg(t2,h1,T);
A6: t is_1_between h,n by A1,A3,Th22;
  then
A7: t.h=0;
  then t1.h=0 by A4,Th26;
  then t2.h=0 by A4,A5,Th26;
  then
A8: t3.h=0 by A4,Th26;
A9: TRAN(s) =Zero_Tran.[s`1_3, s3.Head(s)] by Def19
    .=Zero_Tran.[0,s3.Head(s)] by A2
    .=Zero_Tran.[0,t.Head(s)] by A2
    .=[1,0,1] by A2,A7,Th33;
  then
A10: offset TRAN(s)=1;
  set Rs=(Computation s).(1+1+1+1);
  reconsider p3=3 as State of ZeroTuring by Lm8;
A11: h+1+1=h+0+2;
A12: t3.(h+1)=1 by Th26;
A13: now
    let k be Integer;
    assume h < k & k < h+0+2;
    then h+1 <= k & k <= h+1 by A11,INT_1:7;
    hence t3.k=1 by A12,XXREAL_0:1;
  end;
  t1.(h+1)=1 by Th26;
  then
A14: t2.(h+1)=1 by A5,Th26;
  set s3=[p3,h1,t2];
  reconsider s33=s3`3_3 as Tape of ZeroTuring;
A15: TRAN(s3) =Zero_Tran.[s3`1_3, s33.Head(s3)] by Def19
    .=Zero_Tran.[p3,s33.Head(s3)]
    .=Zero_Tran.[p3,t2.Head(s3)]
    .=[4,1,-1] by A14,Th33;
  then
A16: offset TRAN(s3)=-1;
  reconsider p2=2 as State of ZeroTuring by Lm8;
  reconsider s13=s1`3_3 as Tape of ZeroTuring;
  h <= h+m by NAT_1:11;
  then
A17: h+2 <= h+m+2 by XREAL_1:7;
  h1 < h+2 by XREAL_1:8;
  then
A18: h1 < n by A17,XXREAL_0:2;
A19: TRAN(s1) =Zero_Tran.[s1`1_3, s13.Head(s1)] by Def19
    .=Zero_Tran.[p1,s13.Head(s1)]
    .=Zero_Tran.[p1,t.Head(s1)]
    .=Zero_Tran.[1,t.h1]
    .=[2,1,1] by A6,A4,A18,Th33;
  then
A20: offset TRAN(s1)=1;
A21: now
A22: the Symbols of ZeroTuring = {0,1} by Def19;
    per cases by A22,TARSKI:def 2;
    suppose
      t1.i2=1;
      hence Zero_Tran.[2,t1.i2 ]=[3,0,-1] by Th33;
    end;
    suppose
      t1.i2=0;
      hence Zero_Tran.[2,t1.i2 ]=[3,0,-1] by Th33;
    end;
  end;
  set s2=[p2,i2,t1];
  reconsider s23=s2`3_3 as Tape of ZeroTuring;
A23: TRAN(s2) =Zero_Tran.[s2`1_3, s23.Head(s2)] by Def19
    .=Zero_Tran.[p2,s23.Head(s2)]
    .=Zero_Tran.[p2,t1.Head(s2)]
    .=[3,0,-1] by A21;
  then
A24: offset TRAN(s2)=-1;
  Tape-Chg(s2`3_3, Head(s2),(TRAN(s2))`2_3) =Tape-Chg(t1, Head(s2),(TRAN(s2))
  `2_3)
    .=Tape-Chg(t1,i2,(TRAN(s2))`2_3)
    .=t2 by A23;
  then
A25: Following s2 = [(TRAN(s2))`1_3, Head(s2)+ offset TRAN(s2), t2] by Lm10
    .= [3, Head(s2)+ offset TRAN(s2), t2] by A23
    .= s3 by A24;
  reconsider p3=3 as State of ZeroTuring by Lm8;
A26: Tape-Chg(s3`3_3, Head(s3),(TRAN(s3))`2_3) =
    Tape-Chg(t2, Head(s3),(TRAN(s3))
  `2_3)
    .=Tape-Chg(t2,h1,(TRAN(s3))`2_3)
    .=t3 by A15;
  set s3=[p3,h1,t2];
A27: Following s3 = [(TRAN(s3))`1_3, Head(s3)+ offset TRAN(s3), t3] by A26,Lm10
    .= [4, Head(s3)+ offset TRAN(s3), t3] by A15
    .= [4, h,t3] by A16;
  Tape-Chg(s`3_3, Head(s),(TRAN(s))`2_3)=
   Tape-Chg(t, Head(s),(TRAN(s))`2_3) by A2
    .=Tape-Chg(t,h,(TRAN(s))`2_3) by A2
    .=Tape-Chg(t,h,F) by A9
    .=t by A7,Th24;
  then
A28: Following s = [(TRAN(s))`1_3, Head(s)+offset TRAN(s),t] by A2,Lm10
    .= [1, Head(s)+ offset TRAN(s),t] by A9
    .= s1 by A2,A10;
  Tape-Chg(s1`3_3,Head(s1),(TRAN(s1))`2_3) =Tape-Chg(t,Head(s1),(TRAN(s1))`2_3)
    .=Tape-Chg(t,h1,(TRAN(s1))`2_3)
    .=t1 by A19;
  then
A29: Following s1 = [(TRAN(s1))`1_3, Head(s1)+ offset TRAN(s1), t1] by Lm10
    .= [2, Head(s1)+ offset TRAN(s1), t1] by A19
    .= s2 by A20;
A30: Rs= Following (Computation s).(1+1+1) by Def7
    .= Following Following (Computation s).(1+1) by Def7
    .= Following Following Following (Computation s).1 by Def7
    .=[4, h,t3] by A28,A29,A25,A27,Th9;
  then
A31: Rs`1_3 = 4
    .=the AcceptS of ZeroTuring by Def19;
  hence s is Accept-Halt;
  then
A32: Result s =Rs by A31,Def9;
  hence (Result s)`2_3= h by A30;
A33: (Result s)`3_3= t3 by A30,A32;
  t2.i2=0 by Th26;
  then t3.i2=0 by A5,Th26;
  then t3 is_1_between h,h+0+2 by A8,A13;
  hence thesis by A33,Th16;
end;
