reserve X for set;
reserve a,b,c,k,m,n for Nat;
reserve i,j for Integer;
reserve r,s for Real;
reserve p,p1,p2,p3 for Prime;

theorem Th43:
  for f being natural-valued finite-support SetPrimes-defined Function holds
  f is increasing implies
  for F being real-valued FinSequence st
  F = ((EmptyBag SetPrimes)+*f)*canFS(support((EmptyBag SetPrimes)+*f))
  holds sort_a(F) is increasing
  proof
    let f be natural-valued finite-support SetPrimes-defined Function such that
A1: f is increasing;
    set b = B+*f;
    set C = canFS(support b);
    let F be real-valued FinSequence such that
A2: F = b*C;
    set S = sort_a(F);
A3: F,S are_fiberwise_equipotent by RFINSEQ2:def 6;
A4: dom(b*C) = dom C by Th13;
A5: rng C = support b by FUNCT_2:def 3;
A6: support b = support f by Th12;
A7: support f c= dom f by PRE_POLY:37;
    let e1,e2 be Nat such that
A8: e1 in dom S & e2 in dom S and
A9: e1 < e2;
    consider z1,z2 being set such that
A10: z1 in dom F & z2 in dom F and
A11: z1 <> z2 and
A12: F.z1 = S.e1 & F.z2 = S.e2 by A3,A8,A9,CONVEX2:13;
A13: C.z1 <> C.z2 by A2,A4,A10,A11,FUNCT_1:def 4;
A14: C.z1 in rng C & C.z2 in rng C by A2,A4,A10,FUNCT_1:def 3;
    then b.(C.z1) = f.(C.z1) & b.(C.z2) = f.(C.z2) by A5,A6,A7,FUNCT_4:13;
    then
A15: F.z1 = f.(C.z1) & F.z2 = f.(C.z2) by A2,A10,FUNCT_1:12;
    S.e1 <= S.e2 by A8,A9,RFINSEQ2:17;
    hence thesis by A1,A5,A6,A7,A12,A13,A14,A15,FUNCT_1:def 4,XXREAL_0:1;
  end;
