reserve a, b, n for Nat,
  r for Real,
  f for FinSequence of REAL;
reserve p for Prime;

theorem Th19:
  for X being set, a, b being bag of X st support a misses support b
  holds Product (a+b) = (Product a) * Product b
proof
  let X be set, a, b be bag of X;
  set ab= a+b;
  set Pa = Product a, Pb = Product b, Pab = Product ab;
  set sab = support (a+b);
  set sa = support a;
  set sb = support b;
  set ca = canFS(support a), cb = canFS(support b);
  set cg = ca^cb, cf = canFS(support ab);
  set p = cg" * cf;
A1: rng cf = sab by FUNCT_2:def 3;
  assume support a misses support b;
  then
A2: support a /\ support b = {};
A3: rng ca = sa by FUNCT_2:def 3;
A4: sab = sa \/ sb by PRE_POLY:38;
A5: rng cb = sb by FUNCT_2:def 3;
  then
A6: rng cg = sab by A4,A3,FINSEQ_1:31;
A7: len cb = card sb & len ca = card sa by FINSEQ_1:93;
  then
A8: len cg = card sa + card sb - card {} by FINSEQ_1:22
    .= card sab by A2,A4,CARD_2:45;
  then
A9: cg is one-to-one by A6,FINSEQ_4:62;
  then
A10: dom (cg") = sab by A6,FUNCT_1:33;
  then
A11: rng p = rng (cg") by A1,RELAT_1:28;
  dom cg = Seg card sab by A8,FINSEQ_1:def 3;
  then
A12: rng (cg") = Seg card sab by A9,FUNCT_1:33;
  consider fa being FinSequence of COMPLEX such that
A13: Pa = Product fa and
A14: fa = a*canFS(support a) by Def5;
  consider fb being FinSequence of COMPLEX such that
A15: Pb = Product fb and
A16: fb = b*canFS(support b) by Def5;
  set g = fa^fb;
  consider f being FinSequence of COMPLEX such that
A17: Pab = Product f and
A18: f = ab*canFS(support ab) by Def5;
  dom a = X by PARTFUN1:def 2;
  then
A19: dom ca = dom fa by A14,A3,RELAT_1:27;
  then
A20: len ca = len fa by FINSEQ_3:29;
  len cf = card sab by FINSEQ_1:93;
  then
A21: dom cf = Seg card sab by FINSEQ_1:def 3;
  then
A22: dom p = Seg card sab by A1,A10,RELAT_1:27;
A23: dom ab = X by PARTFUN1:def 2;
  then
A24: dom f = Seg card sab by A18,A21,A1,RELAT_1:27;
  dom b = X by PARTFUN1:def 2;
  then dom cb = dom fb by A16,A5,RELAT_1:27;
  then
A25: len cb = len fb by FINSEQ_3:29;
  then len g = card sa + card sb - card {} by A7,A20,FINSEQ_1:22
    .= card sab by A2,A4,CARD_2:45;
  then
A26: dom g = Seg card sab by FINSEQ_1:def 3;
  then reconsider p as Function of dom g, dom g by A12,A22,A11,FUNCT_2:1;
  p is onto by A12,A26,A11,FUNCT_2:def 3;
  then reconsider p as Permutation of dom g by A9;
A27: dom (g*p) = Seg card sab by A12,A22,A26,A11,RELAT_1:27;
A28: len cg = len ca + len cb by FINSEQ_1:22;
  now
    let x be object;
    set cgx = cg".(cf.x);
    assume
A29: x in dom f;
    then
A30: (g*p).x = g.(p.x) by A24,A27,FUNCT_1:12
      .= g.cgx by A21,A24,A29,FUNCT_1:13;
A31: cf.x in sab by A21,A1,A24,A29,FUNCT_1:3;
    then consider d being object such that
A32: d in dom cg and
A33: cg.d = cf.x by A6,FUNCT_1:def 3;
    cgx in Seg card sab by A10,A12,A31,FUNCT_1:3;
    then reconsider cgx as Nat;
    reconsider cgxN = cgx as Nat;
A34: cgx = d by A9,A32,A33,FUNCT_1:34;
    then
A35: 1 <= cgxN by A32,FINSEQ_3:25;
A36: cgxN <= len fa + len fb by A20,A25,A28,A32,A34,FINSEQ_3:25;
    per cases by A4,A31,XBOOLE_0:def 3;
    suppose
      cf.x in sa;
      then
A37:  not cf.x in sb by A2,XBOOLE_0:def 4;
      now
A38:    cgx -len ca <= len ca + len cb - len ca by A20,A25,A36,XREAL_1:9;
        assume len fa < cgx;
        then
A39:    len fa +1 <= cgx by NAT_1:13;
        then
A40:    len ca +1 - len ca <= cgx - len ca by A20,XREAL_1:9;
        then cgx - len ca is Element of NAT by INT_1:3;
        then
A41:    cgx-len ca in dom cb by A40,A38,FINSEQ_3:25;
        cg.cgxN = cb.(cgx-len ca) by A20,A25,A36,A39,FINSEQ_1:23;
        hence contradiction by A5,A33,A34,A37,A41,FUNCT_1:3;
      end;
      then
A42:  cgxN in dom fa by A35,FINSEQ_3:25;
      then
A43:  cg.cgx = ca.cgx by A19,FINSEQ_1:def 7;
A44:  g.cgx = fa.cgxN by A42,FINSEQ_1:def 7
        .= a.(cf.x) by A14,A19,A33,A34,A42,A43,FUNCT_1:13;
      thus f.x = ab.(cf.x) by A18,A29,FUNCT_1:12
        .= a.(cf.x) + b.(cf.x) by PRE_POLY:def 5
        .= a.(cf.x) + 0 by A37,PRE_POLY:def 7
        .= (g*p).x by A30,A44;
    end;
    suppose
A45:  cf.x in sb;
A46:  now
        assume len fa +1 > cgx;
        then cgx <= len fa by NAT_1:13;
        then
A47:    cgx in dom ca by A19,A35,FINSEQ_3:25;
        then ca.cgx in sa by A3,FUNCT_1:3;
        then cg.cgxN in sa by A47,FINSEQ_1:def 7;
        hence contradiction by A2,A33,A34,A45,XBOOLE_0:def 4;
      end;
      then
A48:  cg.cgx = cb.(cgx-len ca) by A20,A25,A36,FINSEQ_1:23;
A49:  cgx-len ca <= len ca + len cb - len ca by A20,A25,A36,XREAL_1:9;
A50:  len ca + 1 - len ca <= cgx-len ca by A20,A46,XREAL_1:9;
      then cgxN-len ca in NAT by INT_1:3;
      then
A51:  cgxN-len ca in dom cb by A49,A50,FINSEQ_3:25;
A52:  g.cgx = fb.(cgxN-len fa) by A36,A46,FINSEQ_1:23
        .= b.(cf.x) by A16,A20,A33,A34,A48,A51,FUNCT_1:13;
A53:  not cf.x in sa by A2,A45,XBOOLE_0:def 4;
      thus f.x = ab.(cf.x) by A18,A29,FUNCT_1:12
        .= a.(cf.x) + b.(cf.x) by PRE_POLY:def 5
        .= 0 + b.(cf.x) by A53,PRE_POLY:def 7
        .= (g*p).x by A30,A52;
    end;
  end;
  then
A54: f = g*p by A18,A21,A1,A23,A27,FUNCT_1:2,RELAT_1:27;
  thus Product (a+b) = multcomplex $$ f by A17,RVSUM_1:def 13
    .= multcomplex $$ g by A54,FINSOP_1:7
    .= Product g by RVSUM_1:def 13
    .= (Product a) * Product b by A13,A15,RVSUM_1:97;
end;
