reserve m,n for Nat,
  I for Program of SCM+FSA,
  s,s1,s2 for State of SCM+FSA,
  a for Int-Location,
  f for FinSeq-Location,
  p,p1,p2 for Instruction-Sequence of SCM+FSA;

theorem Th13:
  for I being keepInt0_1 InitHalting really-closed Program of SCM+FSA,
      J being InitHalting really-closed Program of SCM+FSA,
      s being State of SCM+FSA st
 Initialize ((intloc 0) .--> 1) c= s & I ";" J c= p
  holds IC Comput(p, s,LifeSpan(p +* I,s) + 1) =  card I &
   DataPart Comput(p, s,LifeSpan(p +* I,s) + 1) =
    DataPart(Comput(p +* I, s,LifeSpan(p +* I,s))
       +* Initialize ((intloc 0) .--> 1)) &
  Reloc(J,card I) c= p &
  Comput(p, s,LifeSpan(p +* I,s) + 1).intloc 0 = 1 & p halts_on s &
   LifeSpan(p,s) = LifeSpan(p +* I,s) + 1 +
 LifeSpan(p +* I +* J,
Result(p +* I,s) +*Initialize ((intloc 0) .--> 1)) & (J is keeping_0 implies
(Result(p,s)).intloc 0 = 1)
proof
  set D = Data-Locations SCM+FSA;
  let I be keepInt0_1 InitHalting really-closed Program of SCM+FSA;
  let J be InitHalting really-closed Program of SCM+FSA;
  let s be State of SCM+FSA;
  set s1 = s +* EP,
      p1 = p +* I;
  set s3 = Comput(p1, s,LifeSpan(p1,s)) +* iS,
      p3 = p1 +* J;
  set m1 = LifeSpan(p1,s);
  set m3 = LifeSpan(p3,s3);
A1: J c= p3 by FUNCT_4:25;
  assume
A2: iS c= s;
  then
A3: s = Initialized s by FUNCT_4:98;
  assume
A4: I ";" J c= p;
  then
A5: p +*(I ";" J) = p by FUNCT_4:98;
A6: I c= p1 by FUNCT_4:25;
  set s4 = Comput(p, s,m1 + 1),
      p4 = p;
A7: Directed I c= I ";" J by SCMFSA6A:16;
   then
A8: Directed I c= p by A4,XBOOLE_1:1;
A9: p = p +* Directed I by A4,A7,FUNCT_4:98,XBOOLE_1:1;
  reconsider m = m1 + 1 + m3 as Element of NAT by ORDINAL1:def 12;
A10: dom Directed I = dom I by FUNCT_4:99;
A11: p1 +* Directed I = p +* (I +* Directed I) by FUNCT_4:14
    .= p by A9,A10,FUNCT_4:19;
A12: iS c= s3 by FUNCT_4:25;
  then dom iS c= dom s3 by GRFUNC_1:2;
  then
A13: dom iS c= the carrier of SCM+FSA by PARTFUN1:def 2;
A14: Reloc(J,card I) c= I ";" J by SCMFSA6A:38;
A15:  I c= p+*I by FUNCT_4:25;
  then
A16: p+*I halts_on s by Def1,A2;
  hence
A17: IC Comput(p, s,LifeSpan(p +* I,s) + 1) = card I by A2,Th9,A8;
A18: now
    let x be object;
    assume x in dom DataPart iS;
    then
A19: x in dom (iS) /\ D by RELAT_1:61;
    then
     x in dom iS by XBOOLE_0:def 4;
    then
A20: x in {IC SCM+FSA,intloc 0} by Lm2,ENUMSET1:1;
A21: x in D by A19,XBOOLE_0:def 4;
    per cases by A20,TARSKI:def 2;
    suppose
A22:  x = intloc 0;
      thus (DataPart iS).x
             = 1 by A22,A21,FUNCT_1:49,SCMFSA_M:12
        .= Comput(p1,s,m1).x by A22,Def2,A6,A2
        .= (DataPart Comput(p1,s,m1)).x by A21,FUNCT_1:49;
    end;
    suppose
      x = IC SCM+FSA;
      then not x in Data-Locations SCM+FSA by STRUCT_0:3;
      hence
      (DataPart iS).x = (DataPart Comput(p1,s,m1)).x by A19,XBOOLE_0:def 4;
    end;
  end;
A23: p3 halts_on s3 by Def1,A1,A12;
  dom (DataPart iS) = dom iS /\ D by RELAT_1:61;
  then dom (DataPart iS) c= (the carrier of SCM+FSA) /\ D by A13,XBOOLE_1:26;
  then dom (DataPart iS) c= dom Comput(p1,s,m1) /\ D by PARTFUN1:def 2;
  then
A24: dom (DataPart iS) c= dom DataPart Comput(p1,s,m1) by RELAT_1:61;
A25:  DataPart s3 = DataPart Comput(p1,s,m1) +* DataPart iS by FUNCT_4:71;
A26: DataPart iS c= DataPart Comput(p1,s,m1) by A18,A24,GRFUNC_1:2;
A27: DataPart Comput(p1,s,m1) = DataPart s3 by A26,A25,FUNCT_4:98;
A28: p+*I halts_on s by A2,Def1,A15;
  DataPart Comput(p,s,m1) = DataPart s3 by A27,A3,A16,Th12,A5;
  hence
A29: DataPart Comput(p, s,m1 + 1) = DataPart s3 by A2,Th10,A8,A28;
  thus Reloc(J,card I) c= p by A4,A14,XBOOLE_1:1;
A30: Reloc(J,card I) c= p4 by A14,A4,XBOOLE_1:1;
  intloc 0 in Int-Locations by AMI_2:def 16;
  then
A31: intloc 0 in D by SCMFSA_2:100,XBOOLE_0:def 3;
  hence s4.intloc 0 = (DataPart s3).intloc 0 by A29,FUNCT_1:49
    .= s3.intloc 0 by A31,FUNCT_1:49
    .= 1 by FUNCT_4:13,SCMFSA_M:10,12;
A32: Comput(p,s,m1 + 1 + m3) = Comput(p,Comput(p,s,m1 + 1),m3) by EXTPRO_1:4;
A33: iS c= s3 by FUNCT_4:25;
  then IncAddr(CurInstr(p3,Comput(p3,s3,m3)),card I)
   = CurInstr(p,Comput(p, s,m1 + 1 + m3))
    by A32,A17,A29,Th4,A1,A30;
  then
A34: CurInstr(p,Comput(p,s,m))
     = IncAddr (halt SCM+FSA,card I) by A23,EXTPRO_1:def 15
    .= halt SCM+FSA by COMPOS_0:4;
  hence
A35: p halts_on s by EXTPRO_1:29;
A36: now
    let k be Nat;
    assume m1 + 1 + k < m;
    then
A37: k < m3 by XREAL_1:6;
    assume
A38: CurInstr(p,Comput(p, s,m1 + 1 + k)) = halt SCM+FSA;
A39:   IncAddr(CurInstr(p3,Comput(p3,s3,k)),card I)
     = CurInstr(p4,Comput(p,s4,k)) by A17,A29,A33,Th4,A1,A30
      .= halt SCM+FSA by A38,EXTPRO_1:4;
    InsCode halt SCM+FSA = 0 by COMPOS_1:70;
    then InsCode CurInstr(p3,Comput(p3,s3,k)) = 0
     by A39,COMPOS_0:def 9;
    then CurInstr(p3,Comput(p3,s3,k))
     = halt SCM+FSA by SCMFSA_2:95;
    hence contradiction by A23,A37,EXTPRO_1:def 15;
  end;
  now
    let k be Nat;
    assume
A40: k < m;
    per cases;
    suppose k <= m1;
      hence CurInstr(p,Comput(p,s,k)) <> halt SCM+FSA
       by Th11,A11,A2,FUNCT_4:25;
    end;
    suppose
      m1 < k;
      then m1 + 1 <= k by NAT_1:13;
      then consider kk being Nat such that
A41:  m1 + 1 + kk = k by NAT_1:10;
      reconsider kk as Element of NAT by ORDINAL1:def 12;
      m1+1+kk=k by A41;
      hence CurInstr(p,Comput(p,s,k))
       <> halt SCM+FSA by A36,A40;
    end;
  end;
  then
A42: for k being Nat st CurInstr(p,Comput(p,s,k))
   = halt SCM+FSA
  holds m <= k;
  then
A43: LifeSpan(p,s) = m by A34,A35,EXTPRO_1:def 15;
  I c= p+*I by FUNCT_4:25;
  then
A44:  p1 halts_on s by Def1,A2;
   Comput(p1, s,LifeSpan(p1,s))
     = Result(p +* I,s) by A44,EXTPRO_1:23;
  hence LifeSpan(p,s) = LifeSpan(p +* I,s) + 1 +
    LifeSpan(p +* I +* J,Result(p +* I,s) +* iS)
     by A42,A34,A35,EXTPRO_1:def 15;
A45: iS c= s3 by FUNCT_4:25;
A46: DataPart Comput(p3, s3,m3)
 = DataPart Comput(p4, s4,m3) by A17,A29,A33,Th4,A1,A30;
    assume
A47: J is keeping_0;
    thus (Result(p,s)).intloc 0 = Comput(p,s,m).intloc 0 by A35,A43,EXTPRO_1:23
      .= Comput(p, s4,m3).intloc 0 by EXTPRO_1:4
      .= Comput(p3, s3,m3).intloc 0 by A46,SCMFSA_M:2
      .= s3.intloc 0 by A47,A1,SCMFSA6B:def 4
      .= 1 by A45,GRFUNC_1:2,SCMFSA_M:10,12;
end;
