reserve i, j, k, c, m, n for Nat,
  a, x, y, z, X, Y for set,
  D, E for non empty set,
  R for Relation,
  f, g for Function,
  p, q for FinSequence;

theorem
  for F being sequence of  HFuncs D st for i being Nat holds F.i c= F.(i+1)
  holds Union F in HFuncs D
proof
  set X = D;
  let F be sequence of  HFuncs X such that
A1: for i being Nat holds F.i c= F.(i+1);
A2: now
    let n be Element of NAT;
    defpred p[Nat] means F.n c= F.(n+$1);
    let m be Element of NAT;
A3: now
      let i be Nat such that
A4:   p[i];
      F.(n+i) c= F.(n+i+1) by A1;
      hence p[i+1] by A4,XBOOLE_1:1;
    end;
A5: p[0];
A6: for i being Nat holds p[i] from NAT_1:sch 2(A5,A3);
    assume n <= m;
    then consider i being Nat such that
A7: m = n+i by NAT_1:10;
    thus F.n c= F.m by A6,A7;
  end;
  reconsider Y = rng F as non empty Subset of HFuncs X by RELAT_1:def 19;
A8: Y is compatible
  proof
    let f,g be Function;
    assume f in Y;
    then consider i being object such that
A9: i in dom F and
A10: f = F.i by FUNCT_1:def 3;
    assume g in Y;
    then consider j being object such that
A11: j in dom F and
A12: g = F.j by FUNCT_1:def 3;
    reconsider i,j as Element of NAT by A9,A11;
    i <= j or j <= i;
    hence thesis by A2,A10,A12,PARTFUN1:54;
  end;
  Y is PartFunc-set of X*, X
  proof
    let f be Element of Y;
    f is Element of HFuncs X;
    hence thesis;
  end;
  then Union F is PartFunc of X*, X by A8,Th14;
  then reconsider f = Union F as Element of PFuncs(X*, X) by PARTFUN1:45;
A13: dom f=union the set of all dom g where g is Element of Y by A8,Th11;
  f is homogeneous
  proof
    thus dom f is with_common_domain
    proof
    let x,y be FinSequence;
    assume x in dom f;
    then consider A1 being set such that
A14: x in A1 and
A15: A1 in the set of all dom g where g is Element of Y by A13,
TARSKI:def 4;
    consider g1 being Element of Y such that
A16: A1 = dom g1 by A15;
    assume y in dom f;
    then consider A2 being set such that
A17: y in A2 and
A18: A2 in the set of all dom g where g is Element of Y by A13,
TARSKI:def 4;
    consider g2 being Element of Y such that
A19: A2 = dom g2 by A18;
    consider i1 being object such that
A20: i1 in dom F and
A21: g1 = F.i1 by FUNCT_1:def 3;
    consider i2 being object such that
A22: i2 in dom F and
A23: g2 = F.i2 by FUNCT_1:def 3;
    reconsider i1, i2 as Element of NAT by A20,A22;
    i1 <= i2 or i2 <= i1;
    then g1 c= g2 or g2 c= g1 by A2,A21,A23;
    then dom g1 c= dom g2 or dom g2 c= dom g1 by GRFUNC_1:2;
    then dom x = dom y by A14,A16,A17,A19,CARD_3:def 10;
    hence len x = len y by FINSEQ_3:29;
    end;
  end;
  hence thesis;
end;
