reserve A,B,C for Ordinal,
  K,L,M,N for Cardinal,
  x,y,y1,y2,z,u for object,X,Y,Z,Z1,Z2 for set,
  n for Nat,
  f,f1,g,h for Function,
  Q,R for Relation;
reserve ff for Cardinal-Function;
reserve F,G for Cardinal-Function;

theorem
  dom F = dom G & (for x st x in dom F holds F.x in G.x) implies
  Sum F in Product G
proof
  assume that
A1: dom F = dom G and
A2: for x st x in dom F holds F.x in G.x;
  deffunc f(object) = (G.$1)\(F.$1);
  consider f such that
A3: dom f = dom F & for x being object st x in dom F holds f.x = f(x)
from FUNCT_1:sch 3;
  now
    assume {} in rng f;
    then consider x being object such that
A4: x in dom f and
A5: {} = f.x by FUNCT_1:def 3;
    reconsider Fx = F.x, Gx = G.x as Cardinal by A1,A3,A4,Def1;
A6: Fx in Gx by A2,A3,A4;
    not Fx in Fx;
    then Fx in Gx \ Fx by A6,XBOOLE_0:def 5;
    hence contradiction by A3,A4,A5;
  end;
  then
A7: product f <> {} by Th26;
  set a = the Element of product f;
  consider h being Function such that
  a = h
  and dom h = dom f and
A8: for x being object st x in dom f holds h.x in f.x by A7,Def5;
  defpred P[object,Function] means dom $2 = dom F & for x st x in dom F holds
  ($1`2 = x implies $2.x = $1`1) & ($1`2 <> x implies $2.x = h.x);
  defpred R[object,object] means ex g st $2 = g & P[$1,g];
A9: for x being object st x in Union disjoin F ex y being object st R[x,y]
  proof
    let x be object such that x in Union disjoin F;
    deffunc f(object) = x`1;
    deffunc g(object) = h.$1;
    defpred C[object] means $1 = x`2;
    consider g such that
A10: dom g = dom F & for u being object st u in dom F holds
    (C[u] implies g.u = f(u)) & (not C[u] implies g.u = g(u))
    from PARTFUN1:sch 1;
    reconsider y = g as object;
    take y,g;
    thus thesis by A10;
  end;
  consider f1 such that
A11: dom f1 = Union disjoin F &
  for x being object st x in Union disjoin F holds R[x,f1.x]
  from CLASSES1:sch 1(A9);
A12: f1 is one-to-one
  proof
    let x,y be object;
    assume that
A13: x in dom f1 and
A14: y in dom f1 and
A15: f1.x = f1.y and
A16: x <> y;
    consider g1 being Function such that
A17: f1.x = g1 and
A18: P[x,g1] by A11,A13;
    consider g2 being Function such that
A19: f1.y = g2 and
A20: P[y,g2] by A11,A14;
A21: x`2 in dom F by A11,A13,Th22;
A22: y`2 in dom F by A11,A14,Th22;
A23: y`1 in F.(y`2) by A11,A14,Th22;
A24: ex x1,x2 being object st x = [x1,x2] by A11,A13,Th21;
A25: ex x1,x2 being object st y = [x1,x2] by A11,A14,Th21;
A26: x = [x`1,x`2] by A24;
A27: y = [y`1,y`2] by A25;
A28: now
      assume
A29:  x`1 = y`1;
A30:  g2.(y`2) = y`1 by A20,A22;
A31:  g1.(y`2) = h.(y`2) by A16,A18,A22,A26,A27,A29;
A32:  f.(y`2) = (G.(y`2))\(F.(y`2)) by A3,A22;
      h.(y`2) in f.(y`2) by A3,A8,A22;
      hence contradiction by A15,A17,A19,A23,A30,A31,A32,XBOOLE_0:def 5;
    end;
A33: x`2 = y`2 implies g1.(x`2) = x`1 & g2.(x`2) = y`1 by A18,A20,A21;
A34: g1.(y`2) = y`1 by A15,A17,A19,A20,A22;
A35: g1.(y`2) = h.(y`2) by A15,A17,A18,A19,A22,A28,A33;
A36: f.(y`2) = (G.(y`2))\(F.(y`2) ) by A3,A22;
    h.(y`2) in f.(y`2) by A3,A8,A22;
    hence contradiction by A23,A34,A35,A36,XBOOLE_0:def 5;
  end;
  rng f1 c= product G
  proof
    let x be object;
    assume x in rng f1;
    then consider y being object such that
A37: y in dom f1 and
A38: x = f1.y by FUNCT_1:def 3;
    consider g such that
A39: f1.y = g and
A40: P[y,g] by A11,A37;
    now
      let x be object;
      assume
A41:  x in dom G;
      then reconsider Gx = G.x, Fx = F.x as Cardinal by A1,Def1;
A42:  Fx in Gx by A1,A2,A41;
A43:  y`2 = x implies g.x = y`1 by A1,A40,A41;
A44:  y`2 <> x implies g.x = h.x by A1,A40,A41;
A45:  h.x in f.x by A1,A3,A8,A41;
A46:  f.x = Gx \ Fx by A1,A3,A41;
A47:  y`1 in F.(y`2) by A11,A37,Th22;
      Fx c= Gx by A42,CARD_1:3;
      hence g.x in G.x by A43,A44,A45,A46,A47;
    end;
    hence thesis by A1,A38,A39,A40,Def5;
  end;
  then
A48: Sum F c= Product G by A11,A12,CARD_1:10;
  now
    assume Sum F = Product G;
    then Union disjoin F,product G are_equipotent by CARD_1:5;
    then consider f such that
    f is one-to-one and
A49: dom f = Union disjoin F and
A50: rng f = product G;
    deffunc f(object) = G.$1 \ pi(f.:((disjoin F).$1),$1);
    consider K being Function such that
A51: dom K = dom F & for x being object st x in dom F holds K.x = f(x)
from FUNCT_1:sch 3;
    now
      assume {} in rng K;
      then consider x being object such that
A52:  x in dom F and
A53:  {} = K.x by A51,FUNCT_1:def 3;
      reconsider x as set by TARSKI:1;
A54:  K.x = G.x \ pi(f.:((disjoin F).x),x) by A51,A52;
      reconsider Fx = F.x, Gx = G.x as Cardinal by A1,A52,Def1;
A55:  card pi(f.:((disjoin F).x),x) c= card (f.:((disjoin F).x)) by Th20;
A56:  card (f.:((disjoin F).x)) c= card ((disjoin F).x) by CARD_1:67;
      card ((disjoin F).x) = Fx by A52,Th29;
      then
A57:  card pi(f.:((disjoin F).x),x) c= Fx by A55,A56;
A58:  Fx in Gx by A2,A52;
      card Gx = Gx;
      hence contradiction by A53,A54,A57,A58,CARD_1:68,ORDINAL1:12;
    end;
    then
A59: product K <> {} by Th26;
    set t = the Element of product K;
    consider g such that
A60: t = g
    and dom g = dom K and
A61: for x being object st x in dom K holds g.x in K.x by A59,Def5;
    now
      let x;
      assume x in dom K;
      then K.x = G.x \ pi(f.:((disjoin F).x),x) by A51;
      hence K.x c= G.x;
    end;
    then product K c= product G by A1,A51,Th27;
    then t in product G by A59;
    then consider y being object such that
A62: y in dom f and
A63: t = f.y by A50,FUNCT_1:def 3;
    consider X such that
A64: y in X and
A65: X in rng disjoin F by A49,A62,TARSKI:def 4;
    consider x being object such that
A66: x in dom disjoin F and
A67: X = (disjoin F).x by A65,FUNCT_1:def 3;
    reconsider x as set by TARSKI:1;
    g in f.:X by A60,A62,A63,A64,FUNCT_1:def 6;
    then
A68: g.x in pi(f.:((disjoin F).x),x) by A67,Def6;
A69: x in dom F by A66,Def3;
A70: not g.x in G.x \ pi(f.:((disjoin F).x),x) by A68,XBOOLE_0:def 5;
    g.x in (K.x) by A51,A61,A69;
    hence contradiction by A51,A69,A70;
  end;
  hence thesis by A48,CARD_1:3;
end;
