reserve N for with_zero set;
reserve N for with_zero set;
reserve x,y,z,A,B for set,
  f,g,h for Function,
  i,j,k for Nat;
reserve S for IC-Ins-separated non empty
     with_non-empty_values AMI-Struct over N,
  s for State of S;
reserve N for non empty with_zero set,
 S for IC-Ins-separated non empty with_non-empty_values AMI-Struct over N,
  s for State of S;
reserve n for Nat;

theorem Th10:
  for S being halting IC-Ins-separated
   non empty with_non-empty_values AMI-Struct over N
  for l being Nat
  for P being NAT-defined (the InstructionsF of S)-valued Function
   st l .--> halt S c= P
  for p being l-started PartState of S
   holds p is P-halted
proof
  let S be halting IC-Ins-separated
   non empty with_non-empty_values AMI-Struct over N;
  let l be Nat;
  let P be NAT-defined (the InstructionsF of S)-valued Function such that
A1: l .--> halt S c= P;
  let p be l-started PartState of S;
   set h = halt S;
   set I = p +* P;
   let s be State of S such that
A2:  p c= s;
   let Q be Instruction-Sequence of S such that
A3: P c= Q;
   take 0;
     dom Q = NAT by PARTFUN1:def 2;
   hence IC Comput(Q,s,0) in dom Q;
    Start-At(l,S) c=  p by MEMSTR_0:29;
    then
A4: Start-At(l,S) c= s by A2,XBOOLE_1:1;
A5: l.-->h c= Q by A1,A3,XBOOLE_1:1;
    IC S in dom Start-At(l,S) by MEMSTR_0:15;
    then
A7: IC s = IC Start-At(l,S) by A4,GRFUNC_1:2
      .= l by FUNCOP_1:72;
A8: IC s in dom(l.-->h) by A7,TARSKI:def 1;
A9: dom(l.-->h) c= dom Q by A5,RELAT_1:11;
    thus CurInstr(Q, Comput(Q,s,0))
       = CurInstr(Q, s)
      .= Q.IC s by A9,A8,PARTFUN1:def 6
      .= (l.-->h).IC s by A8,A5,GRFUNC_1:2
      .= CurInstr(l .--> h,s) by A8,PARTFUN1:def 6
      .= halt S by A4,A5,Th9;
end;
