reserve I for set;

theorem Th6:
  for B being non-empty ManySortedSet of I, C being ManySortedSet of I
  for A being ManySortedSubset of C, F being ManySortedFunction of A, B
  ex G being ManySortedFunction of C, B st G || A = F
proof
  let B be non-empty ManySortedSet of I, C be ManySortedSet of I, A be
  ManySortedSubset of C, F be ManySortedFunction of A, B;
  defpred P[object,object,object] means
 ex f being Function of A.$3, B.$3 st f = F.$3 &
  ($2 in A.$3 implies $1 = f.$2);
A1: for i being object st i in I
   for x being object st x in C.i ex y being
  object st y in B.i & P[y,x,i]
  proof
    let i be object;
    assume
A2: i in I;
    then reconsider f = F.i as Function of A.i, B.i by PBOOLE:def 15;
    let x be object such that
    x in C.i;
    per cases;
    suppose
A3:   x in A.i;
      take f.x;
      thus f.x in B.i by A2,A3,FUNCT_2:5;
      take f;
      thus thesis;
    end;
    suppose
A4:   not x in A.i;
      consider y being object such that
A5:   y in B.i by A2,XBOOLE_0:def 1;
      take y;
      thus y in B.i by A5;
      take f;
      thus thesis by A4;
    end;
  end;
  consider G being ManySortedFunction of C, B such that
A6: for i being object st i in I
     ex g being Function of C.i, B.i st g  = G.i &
     for x being object st x in C.i holds P[g.x,x,i] from MSSUBFAM:sch 1(A1);
  take G;
  now
    let i be object;
    assume
A7: i in I;
    then reconsider f = F.i as Function of A.i, B.i by PBOOLE:def 15;
A8: dom f = A.i by A7,FUNCT_2:def 1;
    consider g being Function of C.i, B.i such that
A9: g = G.i and
A10: for x being object st x in C.i holds P[g.x,x,i] by A6,A7;
    A c= C by PBOOLE:def 18;
    then
A11: A.i c= C.i by A7;
A12: for x being object st x in A.i holds f.x = (g|(A.i)).x
    proof
      let x be object;
      assume
A13:  x in A.i;
      then ex h being Function of A.i, B.i st h = F.i & (x in A.i implies g.x =
      h.x) by A10,A11;
      hence thesis by A13,FUNCT_1:49;
    end;
    dom g = C.i by A7,FUNCT_2:def 1;
    then
A14: dom (g|(A.i)) = A.i by A11,RELAT_1:62;
    thus (G || A).i = g|(A.i) by A7,A9,MSAFREE:def 1
      .= F.i by A8,A14,A12,FUNCT_1:2;
  end;
  hence thesis;
end;
