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 Th38:
  for F being Function of D, HFuncs E st rng F is compatible &
   for x being Element of D holds dom (F.x) c= n-tuples_on E
    ex f being Element of HFuncs E st f = Union F & dom f c= n-tuples_on E
proof
  set X = D, Y = E;
  let F be Function of X, HFuncs Y;
  assume
A1: rng F is compatible;
  assume
A2: for x being Element of X holds dom (F.x) c= n-tuples_on Y;
A3: rng F is functional
    proof
      let x be object;
A4:   rng F c= HFuncs Y by RELAT_1:def 19;
      assume x in rng F;
      hence thesis by A4;
    end;
    then reconsider rngF = rng F as non empty functional compatible set by A1;
    set D = the set of all dom g where g is Element of rngF;
    reconsider f = Union F as Function by A1,A3;
A5: rng f c= Y
    proof
      let y be object;
      assume y in rng f;
      then consider x being object such that
A6:   x in dom f and
A7:   f.x = y by FUNCT_1:def 3;
      x in union D by A6,Th11;
      then consider d being set such that
A8:  x in d and
A9:  d in D by TARSKI:def 4;
      consider g being Element of rngF such that
A10:  d = dom g by A9;
      rng F c= HFuncs Y by RELAT_1:def 19;
      then reconsider g as Element of HFuncs Y;
A11:  g.x in rng g by A8,A10,FUNCT_1:3;
A12:  rng g c= Y by RELAT_1:def 19;
      f.x = g.x by A8,A10,Th12;
      hence thesis by A7,A12,A11;
    end;
A13: dom f c= n-tuples_on Y
    proof
      let x be object;
      assume x in dom f;
      then x in union D by Th11;
      then consider d being set such that
A14:  x in d and
A15:  d in D by TARSKI:def 4;
      consider g being Element of rngF such that
A16:  d = dom g by A15;
      consider e being object such that
A17:  e in dom F and
A18:  F.e = g by FUNCT_1:def 3;
      reconsider e as Element of X by A17;
      dom (F.e) c= n-tuples_on Y by A2;
      hence thesis by A14,A16,A18;
    end;
    n-tuples_on Y c= Y* by FINSEQ_2:142;
    then dom f c= Y* by A13;
    then reconsider f as PartFunc of Y*, Y by A5,RELSET_1:4;
    reconsider f as Element of PFuncs(Y*, Y) by PARTFUN1:45;
    f is homogeneous
    by A13;
    then f in {g where g is Element of PFuncs(Y*, Y): g is homogeneous};
    then reconsider f = Union F as Element of HFuncs Y;
    take f;
    thus f = Union F;
    thus thesis by A13;
end;
