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 Th8:
  for S being IC-Ins-separated halting
non empty with_non-empty_values AMI-Struct over N
  for P being Instruction-Sequence of S
  for s being State of S st ex k st P.IC Comput(P,s,k) = halt S
 for i holds Result(P,s) = Result(P,Comput(P,s,i))
proof
  let S be IC-Ins-separated halting non empty
  with_non-empty_values AMI-Struct over N;
  let P be Instruction-Sequence of S;
  let s be State of S;
  given k such that
A1: P.IC Comput(P,s,k) = halt S;
  let i;
A2: dom P = NAT by PARTFUN1:def 2;
  set s9 = Comput(P,s,k);
A3: CurInstr(P, s9) = halt S by A1,A2,PARTFUN1:def 6;
  now
    per cases;
    suppose
      i <= k;
      then consider j being Nat such that
A4:   k = i + j by NAT_1:10;
      reconsider j as Nat;
A5:   Comput(P,s,k) = Comput(P,Comput(P,s,i),j) by A4,Th4;
A6:   P halts_on Comput(P,s,i) by A3,A5,A2;
      thus Result(P,s) = s9 by A1,Th7
        .= Result(P,Comput(P,s,i)) by A3,A5,A6,Def9;
    end;
    suppose
A7:   i >= k;
A8:   Comput(P,Comput(P,s,k),0) = Comput(P,s,k);
A9:   Comput(P,s,i) = s9 by A3,A7,Th5;
A10:   P halts_on Comput(P,s,i) by A2,A9,A3,A8;
      thus Result(P,s) = s9 by A1,Th7
        .= Result(P,Comput(P,s,i)) by A3,A9,A8,A10,Def9;
    end;
  end;
  hence thesis;
end;
