reserve x,y,y1,y2,z,a,b for object, X,Y,Z,V1,V2 for set,
  f,g,h,h9,f1,f2 for Function,
  i for Nat,
  P for Permutation of X,
  D,D1,D2,D3 for non empty set,
  d1 for Element of D1,
  d2 for Element of D2,
  d3 for Element of D3;

theorem
  (uncurry f in Funcs([:X,Y:],Z) or uncurry' f in Funcs([:Y,X:],Z)) &
  rng f c= PFuncs(V1,V2) & dom f = X implies f in Funcs(X,Funcs(Y,Z))
proof
  assume that
A1: uncurry f in Funcs([:X,Y:],Z) or uncurry' f in Funcs([:Y,X:],Z) and
A2: rng f c= PFuncs(V1,V2) and
A3: dom f = X;
A4: uncurry' f = ~uncurry f by FUNCT_5:def 4;
A5: (ex g st uncurry f = g & dom g = [:X,Y:] & rng g c= Z) or ex g st
  uncurry' f = g & dom g = [:Y,X:] & rng g c= Z by A1,FUNCT_2:def 2;
  then
A6: dom uncurry' f = [:Y,X:] by A4,FUNCT_4:46;
  rng f c= Funcs(Y,Z)
  proof
    let y be object;
    assume
A7: y in rng f;
    then consider x being object such that
A8: x in dom f and
A9: y = f.x by FUNCT_1:def 3;
    ex g st y = g & dom g c= V1 & rng g c= V2 by A2,A7,PARTFUN1:def 3;
    then reconsider h = y as Function;
A10: dom h = Y
    proof
      thus dom h c= Y
      proof
        let z be object;
        assume z in dom h;
        then [z,x] in dom uncurry' f by A8,A9,FUNCT_5:39;
        hence thesis by A6,ZFMISC_1:87;
      end;
      let z be object;
      assume z in Y;
      then [z,x] in [:Y,X:] by A3,A8,ZFMISC_1:87;
      then [x,z] in dom uncurry f by A4,A6,FUNCT_4:42;
      then consider y1,f1,y2 such that
A11:  [x,z] = [y1,y2] and
      y1 in dom f and
A12:  f1 = f.y1 & y2 in dom f1 by FUNCT_5:def 2;
      x = y1 by A11,XTUPLE_0:1;
      hence thesis by A9,A11,A12,XTUPLE_0:1;
    end;
    rng h c= Z
    proof
      let z be object;
      assume z in rng h;
      then ex y1 being object st y1 in dom h & z = h.y1 by FUNCT_1:def 3;
      then z in rng uncurry f & z in rng uncurry' f by A8,A9,FUNCT_5:38,39;
      hence thesis by A5;
    end;
    hence thesis by A10,FUNCT_2:def 2;
  end;
  hence thesis by A3,FUNCT_2:def 2;
end;
