
theorem Th24:
for I being really-closed Program of SCM+FSA,
     k being Nat st k <= card I
  holds Macro goto k ';' I is really-closed
proof let I be really-closed Program of SCM+FSA, l being Nat;
 assume
A1: l <= card I;
   set F = Macro goto l; set G = I; set S = SCM+FSA;
   set P = F ';' I, k = card F -' 1;
    let f be Nat such that
A2: f in dom P;
A3: dom P = dom CutLastLoc F \/ dom Reloc(G,k) by FUNCT_4:def 1;
A4: dom Reloc(G,k) = {(m+k) where m is Nat: m in dom IncAddr(G,k)}
    by VALUED_1:def 12;
    let x be object;
    assume x in NIC(P/.f,f);
    then consider s2 being Element of product the_Values_of S
    such that
A5: x = IC Exec(P/.f,s2) and
A6: IC s2 = f;
A7: P/.f = P.f by A2,PARTFUN1:def 6;
    per cases by A2,A3,XBOOLE_0:def 3;
    suppose
A8:   f in dom CutLastLoc F;
      then
A9:   f < card CutLastLoc F by AFINSQ_1:66;
      card CutLastLoc F = card F - 1 by VALUED_1:38
           .= 2 - 1 by COMPOS_1:56;
      then
A10:   f = 0 by A9,NAT_1:14;
      dom CutLastLoc F misses dom Reloc(G,card F -' 1) by COMPOS_1:18;
     then
A11:  not f in dom Reloc(G,k) by A8,XBOOLE_0:3;
     P/.f = (CutLastLoc F).0 by A10,FUNCT_4:11,A11,A7
       .= goto l;
     then
A12:   x = l by SCMFSA_2:69,A5;
      card P = card F + card I - 1 by COMPOS_1:20
         .= 2 + card I - 1 by COMPOS_1:56
         .= card I + 1;
      then card I < card P by XREAL_1:29;
      then l < card P by A1,XXREAL_0:2;
     hence x in dom P by AFINSQ_1:66,A12;
    end;
    suppose
A13:  f in dom Reloc(G,k);
      then consider m being Nat such that
A14:  f = m+k and
A15:  m in dom IncAddr(G,k) by A4;
A16:  m in dom G by A15,COMPOS_1:def 21;
      then
A17:  NIC(G/.m,m) c= dom G by AMISTD_1:def 9;
A18:  Values IC S = NAT by MEMSTR_0:def 6;
      reconsider m as Element of NAT by ORDINAL1:def 12;
      reconsider v = IC S .--> m as PartState of S by A18;
      set s1 = s2 +* v;
A19:  P/.f = Reloc(G,k).f by A7,A13,FUNCT_4:13
        .= IncAddr(G,k).m by A14,A15,VALUED_1:def 12;
A20:  (IC S .--> m).IC S = m by FUNCOP_1:72;
A21:  IC S in {IC S} by TARSKI:def 1;
A22:  dom (IC S .--> m) = {IC S};
      reconsider w = IC S .--> (IC s1 + k) as PartState of S by A18;
A23:  dom (s1 +* (IC S .--> (IC s1 + k))) = the carrier of S by PARTFUN1:def 2;
A24:    dom s2 = the carrier of S by PARTFUN1:def 2;
      for a being object st a in dom s2 holds
      s2.a = (s1 +* (IC S .--> (IC s1 + k))).a
      proof
        let a be object such that a in dom s2;
A25:    dom (IC S .--> (IC s1 + k)) = {IC S};
        per cases;
        suppose
A26:      a = IC S;
          hence s2.a = IC s1 + k by A6,A14,A22,A20,A21,FUNCT_4:13
            .= (IC S .--> (IC s1 + k)).a by A26,FUNCOP_1:72
            .= (s1 +* (IC S .--> (IC s1 + k))).a by A21,A25,A26,FUNCT_4:13;
        end;
        suppose
A27:      a <> IC S;
          then
A28:      not a in dom (IC S .--> (IC s1 + k)) by TARSKI:def 1;
          not a in dom (IC S .--> m) by A27,TARSKI:def 1;
          then s1.a = s2.a by FUNCT_4:11;
          hence thesis by A28,FUNCT_4:11;
        end;
      end;
      then
A29:  s2 = IncIC(s1,k) by A23,A24,FUNCT_1:2;
      set s3 = s1;
A30:  IC s3 = m by A20,A21,A22,FUNCT_4:13;
      reconsider s3 as Element of product the_Values_of S by CARD_3:107;
      reconsider k,m as Element of NAT;
A31:  x = IC Exec(IncAddr(G/.m,k),s2) by A5,A16,A19,COMPOS_1:def 21
        .= IC Exec(G/.m, s3) + k by A29,AMISTD_2:7;
      IC Exec(G/.m, s3) in NIC(G/.m,m) by A30;
      then IC Exec(G/.m, s3) in dom G by A17;
      then IC Exec(G/.m, s3) in dom IncAddr(G,k) by COMPOS_1:def 21;
      then x in dom Reloc(G,k) by A4,A31;
      hence thesis by A3,XBOOLE_0:def 3;
    end;
  end;
