reserve x for set,
  m,n for Nat,
  a,b,c for Int_position,
  i for Instruction of SCMPDS,
  s,s1,s2 for State of SCMPDS,
  k1,k2 for Integer,
  loc,l1 for Nat,
  I,J for Program of SCMPDS,
  N for with_non-empty_elements set;
reserve P,P1,P2,Q for Instruction-Sequence of SCMPDS;

theorem Th19:
  for s being State of SCMPDS, s1 being 0-started State of SCMPDS,
      J being parahalting shiftable Program of SCMPDS
    st stop J c= P & s = Comput(P1 +* stop J, s1,m)
  holds Exec(CurInstr(P,s),IncIC(s,n)) = IncIC(Following(P,s),n)
proof
  let s be State of SCMPDS, s1 be 0-started State of SCMPDS,
      J be parahalting shiftable Program of SCMPDS;
  set pJ=stop J, s2=s1,
      P2 = P1 +* pJ;
  set i = CurInstr(P,s), ss=s +* Start-At(IC s + n,SCMPDS);
  reconsider k = IC s as Element of NAT;
  reconsider Nl=IC s + 1 as Element of NAT;
A1: IC ss + 1 = (k + n + 1) by FUNCT_4:113
    .= IC (Exec(i, s) +*Start-At (Nl + n,SCMPDS)) by FUNCT_4:113;
  assume
A2: pJ c= P;
  assume
A3:  s=Comput(P2,s2,m);
  pJ c= P2 by FUNCT_4:25;
  then
A4: IC s in dom pJ by A3,SCMPDS_4:def 6;
  reconsider n1 = IC s as Nat;
  set IEn=IC Exec(i,s)+n;
A5: IC ss = IC s + n by FUNCT_4:113;
A6: P/.IC s = P.IC s by PBOOLE:143;
A7: i=pJ.(n1) by A4,A6,A2,GRFUNC_1:2;
  then
A8: InsCode i <> 1 by A4,SCMPDS_4:def 9;
A9: i valid_at n1 by A4,A7,SCMPDS_4:def 9;
A10: InsCode i <> 3 by A4,A7,SCMPDS_4:def 9;
   InsCode i <= 14 by SCMPDS_2:6;
  then InsCode i = 0 or ... or InsCode i = 14;
  then per cases by A8,A10;
  suppose
A11:  InsCode i = 0;
A12:  Following(P,s) = s by A11,SCMPDS_2:86;
   thus Exec(CurInstr(P,s),IncIC(s,n)) = IncIC(s,n) by A11,SCMPDS_2:86
         .= IncIC(Following(P,s),n) by A12;
  end;
  suppose
    InsCode i = 14;
    then consider k1 such that
A13: i = goto k1 and
A14: n1+k1 >= 0 by A9;
A15: IC Exec(i,s) =ICplusConst(s,k1) by A13,SCMPDS_2:54;
A16: now
      let b;
      thus Exec(i, ss).b= ss.b by A13,SCMPDS_2:54
        .= s.b by SCMPDS_3:6
        .= Exec(i, s).b by A13,SCMPDS_2:54
        .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
    end;
    IC Exec(i, ss) =ICplusConst(ss,k1) by A13,SCMPDS_2:54
      .=IEn by A5,A14,A15,SCMPDS_4:27
      .= IC (IncIC(Exec(i,s),n)) by FUNCT_4:113;
    hence thesis by A16,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 2;
    then consider a,k1 such that
A17: i = a := k1 by SCMPDS_2:28;
A18: now
      let b;
      per cases;
      suppose
A19:    a = b;
        hence Exec(i, ss).b = k1 by A17,SCMPDS_2:45
          .= Exec(i,s).b by A17,A19,SCMPDS_2:45
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
      suppose
A20:    a <> b;
        hence Exec(i, ss).b = ss.b by A17,SCMPDS_2:45
          .= s.b by SCMPDS_3:6
          .= Exec(i, s).b by A17,A20,SCMPDS_2:45
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A17,SCMPDS_2:45;
    then IC Exec(i, ss) = IC (IncIC(Exec(i,s),n))
    by A1,A17,SCMPDS_2:45;
    hence thesis by A18,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 4;
    then consider a,k1,k2 such that
A21: i = (a,k1)<>0_goto k2 and
A22: n1+k2 >= 0 by A9;
A23: now
      per cases;
      suppose
A24:    s.DataLoc(s.a,k1) <> 0;
        then
A25:    IC Exec(i,s) =ICplusConst(s,k2) by A21,SCMPDS_2:55;
        ss.DataLoc(s.a,k1) <> 0 by A24,SCMPDS_3:6;
        then ss.DataLoc(ss.a,k1) <> 0 by SCMPDS_3:6;
        hence IC Exec(i, ss) =ICplusConst(ss,k2) by A21,SCMPDS_2:55
          .=IEn by A5,A22,A25,SCMPDS_4:27
          .= IC (IncIC(Exec(i,s),n)) by FUNCT_4:113;
      end;
      suppose
A26:    s.DataLoc(s.a,k1) = 0;
        then ss.DataLoc(s.a,k1) = 0 by SCMPDS_3:6;
        then
A27:    ss.DataLoc(ss.a,k1) = 0 by SCMPDS_3:6;
        IC Exec(i, s) = Nl by A21,A26,SCMPDS_2:55;
        hence IC Exec(i,ss) = IC (IncIC(Exec(i,s),n))
        by A1,A21,A27,SCMPDS_2:55;
      end;
    end;
    now
      let b;
      thus Exec(i, ss).b= ss.b by A21,SCMPDS_2:55
        .= s.b by SCMPDS_3:6
        .= Exec(i, s).b by A21,SCMPDS_2:55
        .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
    end;
    hence thesis by A23,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 5;
    then consider a,k1,k2 such that
A28: i = (a,k1)<=0_goto k2 and
A29: n1+k2 >= 0 by A9;
A30: now
      per cases;
      suppose
A31:    s.DataLoc(s.a,k1) <= 0;
        then
A32:    IC Exec(i,s) =ICplusConst(s,k2) by A28,SCMPDS_2:56;
        ss.DataLoc(s.a,k1) <= 0 by A31,SCMPDS_3:6;
        then ss.DataLoc(ss.a,k1) <= 0 by SCMPDS_3:6;
        hence IC Exec(i, ss) =ICplusConst(ss,k2) by A28,SCMPDS_2:56
          .=IEn by A5,A29,A32,SCMPDS_4:27
          .= IC (IncIC(Exec(i,s),n)) by FUNCT_4:113;
      end;
      suppose
A33:    s.DataLoc(s.a,k1) > 0;
        then ss.DataLoc(s.a,k1) > 0 by SCMPDS_3:6;
        then
A34:    ss.DataLoc(ss.a,k1) > 0 by SCMPDS_3:6;
        IC Exec(i, s) = Nl by A28,A33,SCMPDS_2:56;
        hence IC Exec(i,ss) = IC (IncIC(Exec(i,s),n))
        by A1,A28,A34,SCMPDS_2:56;
      end;
    end;
    now
      let b;
      thus Exec(i, ss).b= ss.b by A28,SCMPDS_2:56
        .= s.b by SCMPDS_3:6
        .= Exec(i, s).b by A28,SCMPDS_2:56
        .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
    end;
    hence thesis by A30,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 6;
    then consider a,k1,k2 such that
A35: i = (a,k1)>=0_goto k2 and
A36: n1+k2 >= 0 by A9;
A37: now
      per cases;
      suppose
A38:    s.DataLoc(s.a,k1) >= 0;
        then
A39:    IC Exec(i,s) =ICplusConst(s,k2) by A35,SCMPDS_2:57;
        ss.DataLoc(s.a,k1) >= 0 by A38,SCMPDS_3:6;
        then ss.DataLoc(ss.a,k1) >= 0 by SCMPDS_3:6;
        hence IC Exec(i, ss) =ICplusConst(ss,k2) by A35,SCMPDS_2:57
          .=IEn by A5,A36,A39,SCMPDS_4:27
          .= IC (IncIC(Exec(i,s),n)) by FUNCT_4:113;
      end;
      suppose
A40:    s.DataLoc(s.a,k1) < 0;
        then ss.DataLoc(s.a,k1) < 0 by SCMPDS_3:6;
        then
A41:    ss.DataLoc(ss.a,k1) < 0 by SCMPDS_3:6;
        IC Exec(i, s) = Nl by A35,A40,SCMPDS_2:57;
        hence IC Exec(i,ss) = IC (IncIC(Exec(i,s),n))
        by A1,A35,A41,SCMPDS_2:57;
      end;
    end;
    now
      let b;
      thus Exec(i, ss).b= ss.b by A35,SCMPDS_2:57
        .= s.b by SCMPDS_3:6
        .= Exec(i, s).b by A35,SCMPDS_2:57
        .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
    end;
    hence thesis by A37,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 7;
    then consider a,k1,k2 such that
A42: i = (a,k1) := k2 by SCMPDS_2:33;
A43: now
      let b;
      per cases;
      suppose
A44:    DataLoc(ss.a,k1) = b;
        then
A45:    DataLoc(s.a,k1) = b by SCMPDS_3:6;
        thus Exec(i, ss).b = k2 by A42,A44,SCMPDS_2:46
          .= Exec(i,s).b by A42,A45,SCMPDS_2:46
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
      suppose
A46:    DataLoc(ss.a,k1) <> b;
        then
A47:    DataLoc(s.a,k1) <> b by SCMPDS_3:6;
        thus Exec(i, ss).b = ss.b by A42,A46,SCMPDS_2:46
          .= s.b by SCMPDS_3:6
          .= Exec(i, s).b by A42,A47,SCMPDS_2:46
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A42,SCMPDS_2:46;
    then IC Exec(i, ss) = IC IncIC(Exec(i,s),n) by A1,A42,SCMPDS_2:46;
    hence thesis by A43,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 8;
    then consider a,k1,k2 such that
A48: i = AddTo(a,k1,k2) by SCMPDS_2:34;
A49: now
      let b;
      per cases;
      suppose
A50:    DataLoc(ss.a,k1) = b;
        then
A51:    DataLoc(s.a,k1) = b by SCMPDS_3:6;
        thus Exec(i, ss).b = ss.b + k2 by A48,A50,SCMPDS_2:48
          .= s.b + k2 by SCMPDS_3:6
          .= Exec(i, s).b by A48,A51,SCMPDS_2:48
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
      suppose
A52:    DataLoc(ss.a,k1) <> b;
        then
A53:    DataLoc(s.a,k1) <> b by SCMPDS_3:6;
        thus Exec(i, ss).b = ss.b by A48,A52,SCMPDS_2:48
          .= s.b by SCMPDS_3:6
          .= Exec(i, s).b by A48,A53,SCMPDS_2:48
          .= (IncIC(Exec(i,s),n)).b by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A48,SCMPDS_2:48;
    then IC Exec(i, ss) = IC IncIC(Exec(i,s),n) by A1,A48,SCMPDS_2:48;
    hence thesis by A49,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 9;
    then consider a,b,k1,k2 such that
A54: i = AddTo(a,k1,b,k2) by SCMPDS_2:35;
A55: now
      let c;
      per cases;
      suppose
A56:    DataLoc(ss.a,k1) = c;
        then
A57:    DataLoc(s.a,k1) = c by SCMPDS_3:6;
A58:    ss.DataLoc(ss.b,k2) =s.DataLoc(ss.b,k2) by SCMPDS_3:6
          .=s.DataLoc(s.b,k2) by SCMPDS_3:6;
        ss.DataLoc(ss.a,k1) =s.DataLoc(ss.a,k1) by SCMPDS_3:6
          .=s.DataLoc(s.a,k1) by SCMPDS_3:6;
        hence
        Exec(i, ss).c = s.DataLoc(s.a,k1) + s.DataLoc(s.b,k2) by A54,A56,A58,
SCMPDS_2:49
          .= Exec(i, s).c by A54,A57,SCMPDS_2:49
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
      suppose
A59:    DataLoc(ss.a,k1) <> c;
        then
A60:    DataLoc(s.a,k1) <> c by SCMPDS_3:6;
        thus Exec(i, ss).c = ss.c by A54,A59,SCMPDS_2:49
          .= s.c by SCMPDS_3:6
          .= Exec(i, s).c by A54,A60,SCMPDS_2:49
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A54,SCMPDS_2:49;
    then IC Exec(i, ss) = IC (IncIC(Exec(i,s),n)) by A1,A54,SCMPDS_2:49;
    hence thesis by A55,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 10;
    then consider a,b,k1,k2 such that
A61: i = SubFrom(a,k1,b,k2) by SCMPDS_2:36;
A62: now
      let c;
      per cases;
      suppose
A63:    DataLoc(ss.a,k1) = c;
        then
A64:    DataLoc(s.a,k1) = c by SCMPDS_3:6;
A65:    ss.DataLoc(ss.b,k2) =s.DataLoc(ss.b,k2) by SCMPDS_3:6
          .=s.DataLoc(s.b,k2) by SCMPDS_3:6;
        ss.DataLoc(ss.a,k1) =s.DataLoc(ss.a,k1) by SCMPDS_3:6
          .=s.DataLoc(s.a,k1) by SCMPDS_3:6;
        hence
        Exec(i, ss).c = s.DataLoc(s.a,k1) - s.DataLoc(s.b,k2) by A61,A63,A65,
SCMPDS_2:50
          .= Exec(i, s).c by A61,A64,SCMPDS_2:50
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
      suppose
A66:    DataLoc(ss.a,k1) <> c;
        then
A67:    DataLoc(s.a,k1) <> c by SCMPDS_3:6;
        thus Exec(i, ss).c = ss.c by A61,A66,SCMPDS_2:50
          .= s.c by SCMPDS_3:6
          .= Exec(i, s).c by A61,A67,SCMPDS_2:50
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A61,SCMPDS_2:50;
    then IC Exec(i, ss) = IC (IncIC(Exec(i,s),n)) by A1,A61,SCMPDS_2:50;
    hence thesis by A62,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 11;
    then consider a,b,k1,k2 such that
A68: i = MultBy(a,k1,b,k2) by SCMPDS_2:37;
A69: now
      let c;
      per cases;
      suppose
A70:    DataLoc(ss.a,k1) = c;
        then
A71:    DataLoc(s.a,k1) = c by SCMPDS_3:6;
A72:    ss.DataLoc(ss.b,k2) =s.DataLoc(ss.b,k2) by SCMPDS_3:6
          .=s.DataLoc(s.b,k2) by SCMPDS_3:6;
        ss.DataLoc(ss.a,k1) =s.DataLoc(ss.a,k1) by SCMPDS_3:6
          .=s.DataLoc(s.a,k1) by SCMPDS_3:6;
        hence Exec(i, ss).c = s.DataLoc(s.a,k1) * s.DataLoc(s.b,k2) by A68,A70
,A72,SCMPDS_2:51
          .= Exec(i, s).c by A68,A71,SCMPDS_2:51
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
      suppose
A73:    DataLoc(ss.a,k1) <> c;
        then
A74:    DataLoc(s.a,k1) <> c by SCMPDS_3:6;
        thus Exec(i, ss).c = ss.c by A68,A73,SCMPDS_2:51
          .= s.c by SCMPDS_3:6
          .= Exec(i, s).c by A68,A74,SCMPDS_2:51
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A68,SCMPDS_2:51;
    then IC Exec(i, ss) = IC (IncIC(Exec(i,s),n)) by A1,A68,SCMPDS_2:51;
    hence thesis by A69,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 12;
    then consider a,b,k1,k2 such that
A75: i = Divide(a,k1,b,k2) by SCMPDS_2:38;
A76: now
      let c;
A77:  ss.DataLoc(ss.a,k1) =s.DataLoc(ss.a,k1) by SCMPDS_3:6
        .=s.DataLoc(s.a,k1) by SCMPDS_3:6;
A78:  ss.DataLoc(ss.b,k2) =s.DataLoc(ss.b,k2) by SCMPDS_3:6
        .=s.DataLoc(s.b,k2) by SCMPDS_3:6;
      per cases;
      suppose
A79:    DataLoc(ss.b,k2) = c;
        then
A80:    DataLoc(s.b,k2) = c by SCMPDS_3:6;
        thus Exec(i, ss).c = s.DataLoc(s.a,k1) mod s.DataLoc(s.b,k2) by A75,A77
,A78,A79,SCMPDS_2:52
          .= Exec(i, s).c by A75,A80,SCMPDS_2:52
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
      suppose
A81:    DataLoc(ss.b,k2) <> c;
        then
A82:    DataLoc(s.b,k2) <> c by SCMPDS_3:6;
        hereby
          per cases;
          suppose
A83:        DataLoc(ss.a,k1) <> c;
            then
A84:        DataLoc(s.a,k1) <> c by SCMPDS_3:6;
            thus Exec(i, ss).c = ss.c by A75,A81,A83,SCMPDS_2:52
              .=s.c by SCMPDS_3:6
              .=Exec(i,s).c by A75,A82,A84,SCMPDS_2:52
              .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
          end;
          suppose
A85:        DataLoc(ss.a,k1) = c;
            then
A86:        DataLoc(s.a,k1) = c by SCMPDS_3:6;
            thus Exec(i, ss).c = s.DataLoc(s.a,k1) div s.DataLoc(s.b,k2) by A75
,A77,A78,A81,A85,SCMPDS_2:52
              .= Exec(i,s).c by A75,A82,A86,SCMPDS_2:52
              .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
          end;
        end;
      end;
    end;
    IC Exec(i, s) = Nl by A75,SCMPDS_2:52;
    then IC Exec(i, ss) = IC (IncIC(Exec(i,s),n)) by A1,A75,SCMPDS_2:52;
    hence thesis by A76,SCMPDS_2:44;
  end;
  suppose
    InsCode i = 13;
    then consider a,b,k1,k2 such that
A87: i = (a,k1):=(b,k2) by SCMPDS_2:39;
A88: now
      let c;
      per cases;
      suppose
A89:    DataLoc(ss.a,k1) = c;
        then
A90:    DataLoc(s.a,k1) = c by SCMPDS_3:6;
        thus Exec(i, ss).c = ss.DataLoc(ss.b,k2) by A87,A89,SCMPDS_2:47
          .=s.DataLoc(ss.b,k2) by SCMPDS_3:6
          .=s.DataLoc(s.b,k2) by SCMPDS_3:6
          .=Exec(i,s).c by A87,A90,SCMPDS_2:47
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
      suppose
A91:    DataLoc(ss.a,k1) <> c;
        then
A92:    DataLoc(s.a,k1) <> c by SCMPDS_3:6;
        thus Exec(i,ss).c = ss.c by A87,A91,SCMPDS_2:47
          .=s.c by SCMPDS_3:6
          .=Exec(i,s).c by A87,A92,SCMPDS_2:47
          .= (IncIC(Exec(i,s),n)).c by SCMPDS_3:6;
      end;
    end;
    IC Exec(i, s) = Nl by A87,SCMPDS_2:47;
    then IC Exec(i, ss) = IC IncIC(Exec(i,s),n) by A1,A87,SCMPDS_2:47;
    hence thesis by A88,SCMPDS_2:44;
  end;
end;
