reserve i,j,x,y for object,
  f,g for Function;

theorem
  for A, B being non empty set, C being non-empty ManySortedSet of A,
  InpFs being ManySortedFunction of A --> B, C, b being Element of B
  ex c being ManySortedSet of A st c = (commute InpFs).b & c in C
proof
  let A, B be non empty set, C be non-empty ManySortedSet of A, InpFs be
  ManySortedFunction of A --> B, C, b be Element of B;
A1: dom InpFs = A by PARTFUN1:def 2;
  dom(uncurry InpFs) = [:A,B:]
  proof
    thus dom(uncurry InpFs) c= [:A,B:]
    proof
      let i be object;
      assume i in dom(uncurry InpFs);
      then consider x,g,y such that
A2:   i = [x,y] and
A3:   x in dom InpFs and
A4:   g = InpFs.x and
A5:   y in dom g by FUNCT_5:def 2;
      g is Function of (A-->B).x, C.x by A1,A3,A4,PBOOLE:def 15;
      then dom g = (A-->B).x by A1,A3,FUNCT_2:def 1;
      then dom g = B by A1,A3,FUNCOP_1:7;
      hence thesis by A1,A2,A3,A5,ZFMISC_1:87;
    end;
    let i1,i2 be object;
    reconsider g = InpFs.[i1,i2]`1 as Function;
    assume
A6: [i1,i2] in [:A,B:];
    then
A7: [i1,i2]`1 in dom InpFs by A1,MCART_1:10;
    g is Function of (A-->B).[i1,i2]`1, C.[i1,i2]`1 by A6,MCART_1:10
,PBOOLE:def 15;
    then dom g = (A-->B).[i1,i2]`1 by A1,A7,FUNCT_2:def 1;
    then dom g = B by A6,FUNCOP_1:7,MCART_1:10;
    then
A8: [i1,i2]`2 in dom g by A6,MCART_1:10;
    thus thesis by A7,A8,FUNCT_5:38;
  end;
  then
A9: commute InpFs = curry' uncurry InpFs & ex g being Function st (curry'
uncurry InpFs).b = g & dom g = A & rng g c= rng uncurry InpFs & for i st i in A
  holds g.i = (uncurry InpFs).(i,b) by FUNCT_5:32,FUNCT_6:def 10;
  then reconsider c = (commute InpFs).b as ManySortedSet of A by PARTFUN1:def 2
,RELAT_1:def 18;
  take c;
  thus c = (commute InpFs).b;
  let i be object;
  reconsider h = InpFs.i as Function;
  assume
A10: i in A;
  then (A-->B).i = B by FUNCOP_1:7;
  then
A11: h is Function of B, C.i by A10,PBOOLE:def 15;
  then
A12: dom h = B by A10,FUNCT_2:def 1;
  c.i = (uncurry InpFs).(i,b) by A9,A10
    .= h.b by A1,A10,A12,FUNCT_5:38;
  hence thesis by A10,A11,FUNCT_2:5;
end;
