reserve P,P1,P2 for Instruction-Sequence of SCM+FSA;

theorem Th16:
  for I,J being really-closed MacroInstruction of SCM+FSA,
      a being read-write
  Int-Location holds for s being State of SCM+FSA st s.a <= 0 &
:::    J is_closed_on Initialized s,P &
    J is_halting_on Initialized s,P
holds IExec(if>0(a,I,J),P,s)
 = IExec(J,P,s) +* Start-At((card I+card J+3),SCM+FSA)
proof
  let I,J be really-closed MacroInstruction of SCM+FSA;
  let a be read-write Int-Location;
  let s be State of SCM+FSA;
  set I1 = I ";" Stop SCM+FSA;
  reconsider JI2 = J ";" Goto  (card I + 1) ";" I ";" Stop SCM+FSA
    as really-closed Program of SCM+FSA by Lm3;
  set s2 = Initialized s, P2 = P +* JI2;
A1: JI2 c= P2 by FUNCT_4:25;
  set P3 = P +* if>0(a,I,J);
  set s4 = Comput(P3, s2,1);
  set s5 = Comput(P3,s2,2);
  set i = a >0_goto  (card J + 3);
  0 in dom if>0(a,I,J) by AFINSQ_1:65;
  then
A2: P3. 0 = if>0(a,I,J). 0 by FUNCT_4:13
    .= i by Lm2;
A3:  1 in dom if>0(a,I,J) by Lm1;
A4: P3. 1 = if>0(a,I,J). 1 by A3,FUNCT_4:13
    .= goto  2 by Lm2;
A5: dom Initialize ((intloc 0) .--> 1) = {intloc 0,IC SCM+FSA} by SCMFSA_M:11;
    a <> intloc 0 & a <> IC SCM+FSA by SCMFSA_2:56;
    then
A6: not a in dom Initialize((intloc 0).-->1) by A5,TARSKI:def 2;
 IC SCM+FSA in dom Initialize((intloc 0).-->1) by MEMSTR_0:48;
  then
A7: IC s2 = IC Initialize((intloc 0).-->1) by FUNCT_4:13
    .=  0 by MEMSTR_0:def 11;
  if>0(a,I,J) = i ";" J ";" Goto  (card I + 1) ";" I1 by SCMFSA6A:25
    .= i ";" J ";" (Goto  (card I + 1) ";" I1) by SCMFSA6A:25
    .= i ";" (J ";" (Goto  (card I + 1) ";" I1)) by SCMFSA6A:29
    .= i ";" (J ";" Goto  (card I + 1) ";" I1) by SCMFSA6A:25
    .= Macro i ";" JI2 by SCMFSA6A:25;
  then Reloc(JI2,card Macro i) c= if>0(a,I,J) by SCMFSA6A:38;
  then
A8: Reloc(JI2,2) c= if>0(a,I,J) by COMPOS_1:56;
 if>0(a,I,J) c= P3 by FUNCT_4:25;
   then
A9: Reloc(JI2,2) c= P3 by A8,XBOOLE_1:1;
A10: Comput(P3, s2,0 + 1) =
Following(P3,Comput(P3,s2,0))
 by EXTPRO_1:3
    .= Following(P3,s2)
    .= Exec(i,s2) by A7,A2,PBOOLE:143;
  assume s.a <= 0;
  then s2.a <= 0 by A6,FUNCT_4:11;
  then
A11: IC Comput(P3,s2,1) = 0+1 by A7,A10,SCMFSA_2:71;
A12: Comput(P3, s2,1 + 1) = Following(P3,s4) by EXTPRO_1:3
    .= Exec(goto  2,s4) by A11,A4,PBOOLE:143;
  then
A13: IC s5 =  2 by SCMFSA_2:69;
A14: now
    let f be FinSeq-Location;
    thus s2.f = Comput(P3,s2,1).f by A10,SCMFSA_2:71
      .= s5.f by A12,SCMFSA_2:69;
  end;
  now
    let a be Int-Location;
    thus s2.a = Comput(P3,s2,1).a by A10,SCMFSA_2:71
      .= s5.a by A12,SCMFSA_2:69;
  end;
  then
A15: DataPart s2 = DataPart s5 by A14,SCMFSA_M:2;
  assume
A16: J is_halting_on Initialized s,P;
  then
A17: P2 halts_on s2 by SCMFSA8A:39;
A18: CurInstr(P3,
Comput(P3,s2,LifeSpan(P2,s2)+2))
 = CurInstr(P3,
 Comput(P3,s5,LifeSpan(P2,s2))) by EXTPRO_1:4
    .= IncAddr(CurInstr(P2, Comput(P2,s2,LifeSpan(P2,s2))),2)
     by A13,A15,Th2,A9,A1
    .= IncAddr(halt SCM+FSA,2) by A17,EXTPRO_1:def 15
    .= halt SCM+FSA by COMPOS_0:4;
  then
A19: P3 halts_on s2 by EXTPRO_1:29;
  now
    let l be Nat;
    assume
A20: l < LifeSpan(P2,s2) + 2;
    per cases;
    suppose
      l = 0;
      hence CurInstr(P3,Comput(P3,s2,l)) <>
       halt SCM+FSA by A7,A2,PBOOLE:143;
    end;
    suppose
      l = 1;
      hence CurInstr(P3,Comput(P3,s2,l)) <>
       halt SCM+FSA by A11,A4,PBOOLE:143;
    end;
    suppose
A21:  l <> 0 & l <> 1;
      assume
A22:  CurInstr(P3,Comput(P3,
s2,l)) = halt SCM+FSA;
      consider n being Nat such that
A23:  l = n + 1 by A21,NAT_1:6;
      n <> 0 by A21,A23;
      then consider l2 being Nat such that
A24:  n = l2 + 1 by NAT_1:6;
      reconsider l2 as Element of NAT by ORDINAL1:def 12;
      InsCode CurInstr(P2,Comput(P2,s2,l2))
       = InsCode IncAddr(CurInstr(P2,
       Comput(P2,s2,l2)),2) by COMPOS_0:def 9
        .= InsCode CurInstr(P3,Comput(P3,s5,l2)) by A13,A15,Th2,A9,A1
        .= InsCode CurInstr(P3,Comput(P3,s2,l2+(1+1))) by EXTPRO_1:4
        .= 0 by A23,A24,A22,COMPOS_1:70;
      then
A25:  CurInstr(P2,Comput(P2,s2,l2)) = halt SCM+FSA by SCMFSA_2:95;
      n + 1 < LifeSpan(P2,s2) + 1 + 1 by A20,A23;
      then n < LifeSpan(P2,s2) + 1 by XREAL_1:6;
      then l2 < LifeSpan(P2,s2) by A24,XREAL_1:6;
      hence contradiction by A17,A25,EXTPRO_1:def 15;
    end;
  end;
  then for l be Nat st CurInstr(P3,
  Comput(P3,s2,l)) = halt SCM+FSA
  holds LifeSpan(P2,s2) + 2 <= l;
  then
A26: LifeSpan(P3,s2) = LifeSpan(P2,s2) + 2 by A18,A19,EXTPRO_1:def 15;
A27: DataPart Result(P2,s2) = DataPart Comput(P2, s2
,LifeSpan(P2,s2)) by A16,EXTPRO_1:23,SCMFSA8A:39
    .= DataPart Comput(P3, s5,LifeSpan(P2,s2)) by A13,A15,Th2,A9,A1
    .= DataPart Comput(P3, s2,LifeSpan(P2,s2) + 2)
by EXTPRO_1:4
    .= DataPart Result(P3,s2) by A19,A26,EXTPRO_1:23;
A28: now
    let x be object;
A30: IExec(if>0(a,I,J),P,s) = (Result(P3,s2)) by SCMFSA6B:def 1;
A31: IExec(JI2,P,s) = Result(P2,s2) by SCMFSA6B:def 1;
    assume
A32: x in dom IExec(if>0(a,I,J),P,s);
    per cases by A32,SCMFSA_M:1;
    suppose
A33:  x is Int-Location;
      then x <> IC SCM+FSA by SCMFSA_2:56;
      then
A34:  not x in dom Start-At((card I+card J+3),SCM+FSA)
by TARSKI:def 1;
      thus IExec(if>0(a,I,J),P,s).x = (Result(P3,s2)).x by A30
        .= (Result(P2,s2)).x by A27,A33,SCMFSA_M:2
        .= IExec(JI2,P,s).x by A31
        .= (IExec(JI2,P,s) +* Start-At((card I+card J+3),SCM+FSA)).x
         by A34,FUNCT_4:11;
    end;
    suppose
A35:  x is FinSeq-Location;
      then x <> IC SCM+FSA by SCMFSA_2:57;
      then
A36:  not x in dom Start-At((card I+card J+3),SCM+FSA)
by TARSKI:def 1;
      thus IExec(if>0(a,I,J),P,s).x = (Result(P3,s2)).x by A30
        .= (Result(P2,s2)).x by A27,A35,SCMFSA_M:2
        .= IExec(JI2,P,s).x by A31
        .= (IExec(JI2,P,s) +* Start-At((card I+card J+3),SCM+FSA)).x
         by A36,FUNCT_4:11;
    end;
    suppose
A37:  x = IC SCM+FSA;
      then
A38:  x in dom Start-At((card I+card J+3),SCM+FSA)by TARSKI:def 1;
A39:  IC Result(P2,s2) = IC IExec(JI2,P,s)
 by A31
        .=  (card I + card J + 1) by A16,SCMFSA8A:40;
      thus IExec(if>0(a,I,J),P,s).x = (Result(P3,s2)).x by A30
        .= Comput(P3, s2,LifeSpan(P2,s2) + 2).x by A19,A26,EXTPRO_1:23
        .= IC Comput(P3, s5,LifeSpan(P2,s2)) by A37,EXTPRO_1:4
        .= IC Comput(P2, s2,LifeSpan(P2,s2)) + 2 by A13,A15,Th2,A9,A1
        .= IC Result(P2,s2) + 2 by A16,EXTPRO_1:23,SCMFSA8A:39
        .= (Start-At ( (card I + card J + 1) + 2,SCM+FSA)).IC SCM+FSA
         by A39,FUNCOP_1:72
        .= (IExec(JI2,P,s) +* Start-At((card I+card J+3),SCM+FSA)).x
         by A37,A38,FUNCT_4:13;
    end;
  end;
  dom IExec(if>0(a,I,J),P,s) = the carrier of SCM+FSA by PARTFUN1:def 2
    .= dom (IExec(JI2,P,s) +* Start-At((card I+card J+3),SCM+FSA))
     by PARTFUN1:def 2;
  hence
  IExec(if>0(a,I,J),P,s)
     = IExec(JI2,P,s) +* Start-At(card I + card J+ 3,SCM+FSA) by A28,FUNCT_1:2
    .= IExec(J,P,s) +* Start-At(card I + card J + 1,SCM+FSA)
     +* Start-At(card I + card J + 3,SCM+FSA) by A16,SCMFSA8A:41
    .= IExec(J,P,s) +* Start-At(card I+card J+3,SCM+FSA)by FUNCT_4:114;
end;
