reserve p for preProgram of SCM+FSA,
  ic for Instruction of SCM+FSA,
  i,j,k for Nat,
  fa,f for FinSeq-Location,
  a,b,da,db for Int-Location,
  la,lb for Nat;
reserve p1,p2,q for Instruction-Sequence of SCM+FSA;
reserve n for Nat;

theorem Th28:
  for p being Instruction-Sequence of SCM+FSA
  for s be State of SCM+FSA,t be FinSequence of INT st
  Initialize((intloc 0).-->1) +*(fsloc 0 .--> t) c= s &
  Bubble-Sort-Algorithm c= p
  ex u being FinSequence of REAL
  st t,u are_fiberwise_equipotent & u is non-increasing &
  u is FinSequence of INT & (Result(p,s)).(fsloc 0) = u
proof
  let p being Instruction-Sequence of SCM+FSA;
  let s be State of SCM+FSA,t be FinSequence of INT;
  set Ba=Bubble-Sort-Algorithm, pp=Initialize((intloc 0).-->1),
  x=fsloc 0 .--> t,
  z=IExec(bubble-sort f0,p,s).f0;
  assume that
A1: pp+*x c= s and
A2: Ba c= p;
A3: p +* Ba = p by A2,FUNCT_4:98;
A4: f0 in dom x by TARSKI:def 1;
  then f0 in dom (pp+*x) by FUNCT_4:12;
  then
A5: s.f0=(pp+*x).f0 by A1,GRFUNC_1:2
    .=x.f0 by A4,FUNCT_4:13
    .=t by FUNCOP_1:72;
A6: s.f0, z are_fiberwise_equipotent by Th26;
  reconsider u=z as FinSequence of REAL by FINSEQ_3:117;
  take u;
  thus t, u are_fiberwise_equipotent by A5,Th26;
A7: dom (s.f0) = dom u by A6,RFINSEQ:3;
  now
    let i,j be Nat;
    assume that
A8: i in dom u and
A9: j in dom u and
A10: i<j;
A11: i>=1 by A8,FINSEQ_3:25;
A12: j<=len (s.f0) by A7,A9,FINSEQ_3:25;
    reconsider y1=z.i as Integer;
    reconsider y2=z.j as Integer;
    thus u.i>=u.j by A10,A11,A12,Th26;
  end;
  hence u is non-increasing by RFINSEQ:19;
  thus u is FinSequence of INT;
  dom pp misses dom x by SCMFSA_M:32;
  then pp c=pp+*x by FUNCT_4:32;
  then s=s+*pp by A1,FUNCT_4:98,XBOOLE_1:1;
  then s= Initialized s;
  hence thesis by Th20,A3;
end;
