reserve P,Q for Instruction-Sequence of SCM+FSA;
reserve m, n for Nat;
reserve f for FinSeq-Location,
  c for Int-Location;
reserve s for State of SCM+FSA,
  I for MacroInstruction of SCM+FSA,
  a for read-write Int-Location;
reserve i,k,m,n for Nat;

theorem Th15:
  for s being State of SCM+FSA,
      I being really-closed MacroInstruction of SCM+FSA,
      a being read-write Int-Location
 st I is_halting_on s,P & s.a >0
holds IC Comput(P +* while>0(a,I), Initialize s,
(LifeSpan(P +* I,Initialize s) + 2)) =  0 &
for k being Nat st k
  <= LifeSpan(P +* I,Initialize s) + 2
  holds IC Comput(P +* while>0(a,I),
   (Initialize s),k) in dom while>0(a,I)
proof
  set D = Int-Locations \/ FinSeq-Locations;
  let s be State of SCM+FSA;
  let I be really-closed MacroInstruction of SCM+FSA;
  let a be read-write Int-Location;
  set sI = Initialize s,
      PI = P +* I;
  set s1 = Initialize s,
      P1 = P +* while>0(a,I);
  defpred P[Nat] means $1 <= LifeSpan(PI,sI) implies IC Comput(
   P1, s1
,1+$1) = IC Comput(PI, sI,$1)+ 3 & DataPart Comput(P1, s1,1+$1) = DataPart
  Comput(PI, sI,$1);
  assume
A1: I is_halting_on s,P;
A2: now
    let k be Nat;
    assume
A3: P[k];
    now
A4:   k + 0 < k + 1 by XREAL_1:6;
      assume k + 1 <= LifeSpan(PI,sI);
      then k < LifeSpan(PI,sI) by A4,XXREAL_0:2;
      hence IC Comput(P1, s1,1+k+1) = IC Comput(PI,sI,k+1) + 3 &
      DataPart Comput(P1, s1,1+k+1) = DataPart Comput(PI, sI,k+1)
        by A1,A3,Th13;
    end;
    hence P[k + 1];
  end;
  reconsider l=LifeSpan(PI,sI) as Element of NAT by ORDINAL1:def 12;
  set loc4= (card I + 3);
  set i = a >0_goto 3;
  set s2 = Comput(P1,s1,1);
 IC SCM+FSA in dom (Start-At(0,SCM+FSA)) by MEMSTR_0:15;
   then
A5: IC s1 = IC(Start-At(0,SCM+FSA)) by FUNCT_4:13
    .=  0 by FUNCOP_1:72;
  not a in dom (Start-At(0,SCM+FSA)) by SCMFSA_2:102;
 then
A6: s1.a = s.a by FUNCT_4:11;
  assume
A7: s.a > 0;
A8:  0 in dom while>0(a,I) by AFINSQ_1:65;
A9:  (P1)/.IC s1 = P1.IC s1 by PBOOLE:143;
  P1. 0 = while>0(a,I). 0 by A8,FUNCT_4:13
    .= i by SCMFSA_X:10;
  then
A10: CurInstr(P1,s1) = i by A5,A9;
A11: Comput(P1,s1,0+1) = Following(P1,Comput(P1,s1,0)) by EXTPRO_1:3
    .= Exec(i,s1) by A10;
  then ( for c holds s2.c = s1.c)& for f holds s2.f = s1.f by SCMFSA_2:71;
  then
A12: DataPart s2 = DataPart sI by SCMFSA_M:2;
A13: IC s2 =  3 by A7,A11,A6,SCMFSA_2:71;
A14: P[ 0]
  proof
    assume 0 <= LifeSpan(PI,sI);
A15: IC SCM+FSA in dom Start-At(0,SCM+FSA) by MEMSTR_0:15;
    IC Comput(PI, sI,0)
       = IC Start-At(0,SCM+FSA) by A15,FUNCT_4:13
      .=  0 by FUNCOP_1:72;
    hence thesis by A13,A12;
  end;
A16: for k being Nat holds P[k] from NAT_1:sch 2(A14,A2);
  set s4= Comput(P1, s1,1+LifeSpan(PI,sI)+1);
  set s3= Comput(P1, s1,1+LifeSpan(PI,sI));
  set s2= Comput(P1, s1,1+LifeSpan(PI,sI));
  P[l] by A16;
  then
A17: CurInstr(P1,s2) = goto 0 by A1,Th14;
A18: CurInstr(P1,s3) = goto  0 by A17;

A19: s4 = Following(P1,s3) by EXTPRO_1:3
    .= Exec(goto  0,s3) by A18;
A20: IC s4 =  0 by A19,SCMFSA_2:69;
  hence IC Comput(P1, s1,LifeSpan(PI,sI)+2) =  0;
A21: now
    let k be Nat;
    assume
A22: k <= LifeSpan(PI,sI)+2;
    assume k<>0;
    then consider n being Nat such that
A23: k = n+ 1 by NAT_1:6;
    k<=LifeSpan(PI,sI)+1 or k >= LifeSpan(PI,sI)+1+1 by NAT_1:13;
    then
A24: k <=LifeSpan(PI,sI)+1 or k = LifeSpan(PI,sI)+2 by A22,XXREAL_0:1;
    reconsider n as Element of NAT by ORDINAL1:def 12;
    per cases by A24;
    suppose
      k<=LifeSpan(PI,sI)+1;
      then n <= LifeSpan(PI,sI) by A23,XREAL_1:6;
      then
A25:  IC Comput(P1,s1,1+n) = IC Comput(PI, sI,n) + 3
by A16;
      reconsider m = IC Comput(PI, sI,n) as Element of NAT;
A26: I c= PI by FUNCT_4:25;
  IC sI = 0 by MEMSTR_0:def 11;
  then IC sI in dom I by AFINSQ_1:65;
  then m in dom I by AMISTD_1:21,A26;
      then m < card I by AFINSQ_1:66;
      then
A27:  m+3 < card I+ 5 by XREAL_1:8;
      card while>0(a,I) = card I + 5 by SCMFSA_X:4;
      hence IC Comput(P1,s1,k) in dom while>0(a,I) by A23,A25,A27,AFINSQ_1:66;
    end;
    suppose
      k >= LifeSpan(PI,sI)+2;
      then k = LifeSpan(PI,sI)+2 by A22,XXREAL_0:1;
      hence IC Comput(P1,s1,k) in dom while>0(a,I) by A20,AFINSQ_1:65;
    end;
  end;
  now
    let k be Nat;
    assume
A28: k <= LifeSpan(PI,sI)+2;
    per cases;
    suppose
      k = 0;
      hence IC Comput(P1,s1,k) in dom while>0(a,I) by A8,A5;
    end;
    suppose
      k <>0;
      hence IC Comput(P1,s1,k) in dom while>0(a,I) by A21,A28;
    end;
  end;
  hence thesis;
end;
