reserve s for State of SCM+FSA,
  I for MacroInstruction of SCM+FSA,
  a for read-write Int-Location;
reserve i,j,k,n for Nat;
reserve P,P1,P2,Q for Instruction-Sequence of SCM+FSA;

theorem
  Insert-Sort-Algorithm, Initialize((intloc 0).-->1)
     computes Sorting-Function
proof
  set q = Insert-Sort-Algorithm,
      p = Initialize((intloc 0).-->1);
  let x be set;
  assume x in dom Sorting-Function;
  then consider w being FinSequence of INT such that
A1: x = fsloc 0 .--> w by SCMFSA_M:35;
  reconsider d = x as data-only FinPartState of SCM+FSA by A1;
A2: dom d = { fsloc 0 } by A1;
  consider t being State of SCM+FSA such that
A3: p +* d c= t by PBOOLE:141;
  consider P be Instruction-Sequence of SCM+FSA
    such that
A4:  q c= P by PBOOLE:145;
    fsloc 0 <> IC SCM+FSA by SCMFSA_2:57;
    then
A5: dom d misses {IC SCM+FSA} by A2,ZFMISC_1:11;
    fsloc 0 <> intloc 0 by SCMFSA_2:58;
    then
A6: dom d misses {intloc 0} by A2,ZFMISC_1:11;
    dom p = dom ((intloc 0).-->1) \/ {IC SCM+FSA} by MEMSTR_0:42
       .= {IC SCM+FSA} \/ {intloc 0};
    then
A7: dom d misses dom p by A5,A6,XBOOLE_1:70;
A8: d +* p = p +* d by A7,FUNCT_4:35;
A9: now
    let t be State of SCM+FSA;
    assume
A10:  (p+*d) c= t;
    let P be Instruction-Sequence of SCM+FSA such that
A11:  q c= P;
    set bf=insert-sort fsloc 0;
    Initialize((intloc 0).-->1) c= (p+*d) by A8,FUNCT_4:25;
    then Initialize((intloc 0).-->1) c= t by A10,XBOOLE_1:1;
   hence P halts_on t by Lm12,A11,SCM_HALT:def 2;
  end;
  take d;
  thus x = d;
 Initialized d = d +* p
        .= p +* d by A7,FUNCT_4:35
        .= (p +* d)
        .= p +* d;
   then
   p +* d is q-halted q-autonomic by A1,A9,Th28;
  hence
A12: p +* d is Autonomy of q by EXTPRO_1:def 12;
  fsloc 0 in the carrier of SCM+FSA;
  then
A13: fsloc 0 in dom Result(P,t) by PARTFUN1:def 2;
  p +* d c= t by A3;
  then
A14:  Result(q,p+*d) = (Result(P,t))|dom(p+*d)
         by A12,A4,EXTPRO_1:def 13;
   Initialize((intloc 0).-->1) +*(fsloc 0 .--> w) c= p+*d by A1;
   then Initialize((intloc 0).-->1) +*(fsloc 0 .--> w) c= t
    by A3,XBOOLE_1:1;
  then consider u being FinSequence of REAL such that
A15: w,u are_fiberwise_equipotent and
A16: u is non-increasing and
  u is FinSequence of INT and
A17: (Result(P,t)).(fsloc 0) = u by Th27,A4;
  consider z being FinSequence of REAL such that
A18: w,z are_fiberwise_equipotent and
A19: z is non-increasing and
  z is FinSequence of INT and
A20: Sorting-Function.d = fsloc 0 .--> z by A1,SCMFSA_M:36;
  d c= p +* d by FUNCT_4:25;
  then
A21: dom d c= dom(p +* d) by RELAT_1:11;
A23: u=z by A18,A19,A15,A16,CLASSES1:76,RFINSEQ:23;
A24: fsloc 0 .--> u c= (Result(P,t)) by A17,A13,FUNCT_4:85;
  dom(fsloc 0 .--> z) c= dom(p +* d)
     by A1,A21;
  then fsloc 0 .--> z c= (Result(P,t))|dom(p+*d)
       by A24,A23,RELAT_1:151;
  hence thesis by A20,A14;
end;
