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 Th12:
  for s being State of SCM+FSA, I being MacroInstruction of SCM+FSA, a
being read-write Int-Location
 st s.a <= 0 holds while>0(a,I) is_halting_on s,P
proof
  let s be State of SCM+FSA;
  let I be MacroInstruction of SCM+FSA;
  let a be read-write Int-Location;
  assume
A1: s.a <= 0;
  set i = a >0_goto 3;
  set s1 = Initialize s,
      P1 = P +* while>0(a,I);
 IC SCM+FSA in dom Start-At(0,SCM+FSA) by MEMSTR_0:15;
  then
A2: IC SCM+FSA in dom Start-At(0,SCM+FSA);
A3: IC s1 = IC Start-At(0,SCM+FSA) by A2,FUNCT_4:13
    .=  0 by FUNCOP_1:72;
  set loc5=  (card I +4);
  set s5 = Comput(P1,s1,3);
  set s4 = Comput(P1,s1,2);
  set s2 = Comput(P1,s1,1);
A4:  1 in dom while>0(a,I) by SCMFSA_X:9;
  not a in dom Start-At(0,SCM+FSA) by SCMFSA_2:102;
  then
A5: s1.a = s.a by FUNCT_4:11;
A6:  (P1)/.IC s1 = P1.IC s1 by PBOOLE:143;
  0 in dom while>0(a,I) by AFINSQ_1:65;
  then P1. 0 = while>0(a,I). 0 by FUNCT_4:13
    .= i by SCMFSA_X:10;
  then
A7: CurInstr(P1,s1) = i by A3,A6;
A8: Comput(P1,s1,0+1) = Following(P1,Comput(P1,s1,0)) by EXTPRO_1:3
    .= Exec(i,s1) by A7;
A9: IC Comput(P1,s1,1) = 0 + 1 by A1,A3,A8,A5,SCMFSA_2:71;
A10:  (P1)/.IC Comput(P1,s1,1) = P1.IC Comput(P1,s1,1) by PBOOLE:143;
    P1. 1 = (while>0(a,I)). 1 by A4,FUNCT_4:13
    .= goto  2 by SCMFSA_X:10;
  then
A11: CurInstr(P1,Comput(P1,s1,1))
 = goto  2 by A9,A10;
A12: Comput(P1,s1,1+1) = Following(P1,s2) by EXTPRO_1:3
    .= Exec(goto  2,s2) by A11;
A13: IC s4 =  2 by A12,SCMFSA_2:69;
A14: 2 in dom while>0(a,I) by SCMFSA_X:7;
A15: loc5 in dom while>0(a,I) by SCMFSA_X:8;
A16:  (P1)/.IC s4 = P1.IC s4 by PBOOLE:143;
  P1. 2 = (while>0(a,I)). 2 by A14,FUNCT_4:13
    .= goto loc5 by SCMFSA_X:17;
  then
A17: CurInstr(P1,s4) = goto loc5 by A13,A16;
A18: Comput(P1,s1,2+1) = Following(P1,s4) by EXTPRO_1:3
    .= Exec(goto loc5,s4) by A17;
A19: IC s5 = loc5 by A18,SCMFSA_2:69;
A20:  (P1)/.IC s5 = P1.IC s5 by PBOOLE:143;
  P1.loc5 = while>0(a,I).loc5 by A15,FUNCT_4:13
    .= halt SCM+FSA by SCMFSA_X:16;
  then
 CurInstr(P1,s5) = halt SCM+FSA by A19,A20;
  then P1 halts_on s1 by EXTPRO_1:29;
  hence while>0(a,I) is_halting_on s,P by SCMFSA7B:def 7;
 thus thesis;
end;
