reserve o,m for set;

theorem Th1:
  for C being Category holds C is with_finite_product iff (ex a
  being Object of C st a is terminal) & for a,b being Object of C ex c being
Object of C, p1,p2 being Morphism of C st dom p1 = c & dom p2 = c & cod p1 = a
  & cod p2 = b & c is_a_product_wrt p1,p2
proof
  let C be Category;
  thus C is with_finite_product implies (ex a being Object of C st a is
  terminal) & for a,b being Object of C ex c being Object of C, p1,p2 being
  Morphism of C st dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c
  is_a_product_wrt p1,p2
  proof
    reconsider F = {} as Function of {},the carrier of C by RELSET_1:12;
    assume
A1: for I being finite set, F being Function of I,the carrier of C ex
    a being Object of C, F9 being Projections_family of a,I st cods F9 = F & a
    is_a_product_wrt F9;
    then consider
    a being Object of C, F9 being Projections_family of a,{} such
    that
    cods F9 = F and
A2: a is_a_product_wrt F9;
    thus ex a being Object of C st a is terminal by A2,CAT_3:50;
    let a,b be Object of C;
    set F = (0,1)-->(a,b);
    consider c being Object of C, F9 being Projections_family of c,{0,1} such
    that
A3: cods F9 = F and
A4: c is_a_product_wrt F9 by A1;
    take c, p1 = F9/.0, p2 = F9/.1;
A5: 1 in {0,1} by TARSKI:def 2;
    then
A6: p2 = F9.1 by FUNCT_2:def 13;
A7: 0 in {0,1} by TARSKI:def 2;
    hence dom p1 = c & dom p2 = c by A5,CAT_3:41;
    F/.0 = a & F/.1 = b by CAT_3:3;
    hence cod p1 = a & cod p2 = b by A3,A7,A5,CAT_3:def 2;
    dom F9 = {0,1} & p1 = F9.0 by A7,FUNCT_2:def 1,def 13;
    then F9 = (0,1)-->(p1,p2) by A6,FUNCT_4:66;
    hence thesis by A4,CAT_3:54;
  end;
  given a being Object of C such that
A8: a is terminal;
  defpred Q[Nat] means for I being finite set, F being Function of I,the
carrier of C st card I = $1 ex a being Object of C, F9 being Projections_family
  of a,I st cods F9 = F & a is_a_product_wrt F9;
  assume
A9: for a,b being Object of C ex c being Object of C, p1,p2 being
  Morphism of C st dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c
  is_a_product_wrt p1,p2;
A10: for n being Nat st Q[n] holds Q[n+1]
  proof
    let n be Nat such that
A11: Q[n];
    let I be finite set, F be Function of I,the carrier of C such that
A12: card I = n+1;
    set x = the Element of I;
    reconsider Ix = I \ {x} as finite set;
    reconsider sx = {x} as finite set;
    reconsider G = F|(I\{x}) as Function of I\{x},the carrier of C by
FUNCT_2:32;
    card(Ix) = card(I) - card(sx) by A12,CARD_1:27,CARD_2:44,ZFMISC_1:31
      .= card(I) - 1 by CARD_1:30
      .= n by A12,XCMPLX_1:26;
    then consider
    a being Object of C, G9 being Projections_family of a,I\{x} such
    that
A13: cods G9 = G and
A14: a is_a_product_wrt G9 by A11;
    consider c being Object of C, p1,p2 being Morphism of C such that
A15: dom p1 = c and
A16: dom p2 = c and
A17: cod p1 = a and
A18: cod p2 = F/.x and
A19: c is_a_product_wrt p1,p2 by A9;
    set F9 = (G9*p1) +* (x .-->p2);
A20: dom({x} -->p2) = {x} by FUNCT_2:def 1;
    rng F9 c= rng(G9*p1) \/ rng(x .-->p2) by FUNCT_4:17;
    then
A21: rng F9 c= the carrier' of C by XBOOLE_1:1;
    dom(G9*p1) = I\{x} by FUNCT_2:def 1;
    then
A22: dom(G9*p1) \/ dom(x .-->p2) = I \/ {x} by A20,XBOOLE_1:39
      .= I by A12,CARD_1:27,ZFMISC_1:40;
    then dom F9 = I by FUNCT_4:def 1;
    then reconsider F9 as Function of I, the carrier' of C by A21,FUNCT_2:def 1
,RELSET_1:4;
A23: doms G9 = (I\{x})-->a by CAT_3:def 13;
    now
      let y be object;
      assume
A24:  y in I;
      now
        per cases;
        suppose
          y = x;
          then
A25:      y in {x} by TARSKI:def 1;
          F9/.y = F9.y by A24,FUNCT_2:def 13
            .= (x .-->p2).y by A20,A25,FUNCT_4:13
            .= p2 by A25,FUNCOP_1:7;
          hence (I --> c).y = dom(F9/.y) by A16,A24,FUNCOP_1:7
            .= (doms F9)/.y by A24,CAT_3:def 1;
        end;
        suppose
A26:      y <> x;
          then
A27:      not y in {x} by TARSKI:def 1;
A28:      y in I\{x} by A24,A26,ZFMISC_1:56;
          F9/.y = F9.y by A24,FUNCT_2:def 13
            .= (G9*p1).y by A20,A22,A24,A27,FUNCT_4:def 1
            .= (G9*p1)/.y by A28,FUNCT_2:def 13;
          hence (doms F9)/.y = dom((G9*p1)/.y) by A24,CAT_3:def 1
            .= (doms(G9*p1))/.y by A28,CAT_3:def 1
            .= ((I\{x})-->c)/.y by A15,A17,A23,CAT_3:16
            .= c by A24,A26,CAT_3:2,ZFMISC_1:56
            .= (I --> c).y by A24,FUNCOP_1:7;
        end;
      end;
      hence (doms F9).y = (I --> c).y by A24,FUNCT_2:def 13;
    end;
    then reconsider F9 as Projections_family of c,I
        by CAT_3:def 13,FUNCT_2:12;
    take c,F9;
A29:  now
      let y be set;
      assume
A30:  y in I;
   now
        per cases;
        suppose
A31:      y = x;
          then
A32:      y in {x} by TARSKI:def 1;
          F9/.y = F9.y by A30,FUNCT_2:def 13
            .= (x .-->p2).y by A20,A32,FUNCT_4:13
            .= p2 by A32,FUNCOP_1:7;
          hence (cods F9)/.y = F/.y by A18,A30,A31,CAT_3:def 2;
        end;
        suppose
A33:      y <> x;
          then
A34:      not y in {x} by TARSKI:def 1;
A35:      y in I\{x} by A30,A33,ZFMISC_1:56;
          F9/.y = F9.y by A30,FUNCT_2:def 13
            .= (G9*p1).y by A20,A22,A30,A34,FUNCT_4:def 1
            .= (G9*p1)/.y by A35,FUNCT_2:def 13;
          hence (cods F9)/.y = cod((G9*p1)/.y) by A30,CAT_3:def 2
            .= (cods(G9*p1))/.y by A35,CAT_3:def 2
            .= G/.y by A13,A17,A23,CAT_3:16
            .= G.y by A35,FUNCT_2:def 13
            .= F.y by A30,A33,FUNCT_1:49,ZFMISC_1:56
            .= F/.y by A30,FUNCT_2:def 13;
        end;
      end;
      hence (cods F9)/.y = F/.y;
    end;
    hence
 cods F9 = F by CAT_3:1;
    thus F9 is Projections_family of c,I;
    let d be Object of C;
    let F99 be Projections_family of d,I such that
A36: cods F9 = cods F99;
    reconsider G99 = F99|(I\{x}) as Function of I\{x},the carrier' of C by
FUNCT_2:32;
 now
      let y be set;
      assume
A37:  y in I\{x};
      then G99/.y = G99.y by FUNCT_2:def 13
        .= F99.y by A37,FUNCT_1:49
        .= F99/.y by A37,FUNCT_2:def 13;
      hence doms(G99)/.y = dom(F99/.y) by A37,CAT_3:def 1
        .= d by A37,CAT_3:41
        .= ((I\{x})-->d)/.y by A37,CAT_3:2;
    end;
    then reconsider G99 as Projections_family of d,I\{x}
               by CAT_3:1,def 13;
    now
      let y be set;
      assume
A38:  y in I\{x};
      then
A39:  G/.y = G.y by FUNCT_2:def 13
        .= F.y by A38,FUNCT_1:49
        .= F/.y by A38,FUNCT_2:def 13;
      F99/.y = F99.y by A38,FUNCT_2:def 13
        .= G99.y by A38,FUNCT_1:49
        .= G99/.y by A38,FUNCT_2:def 13;
      hence (cods G9)/.y = cod(G99/.y)
            by A13,A36,A38,A39,A29,CAT_3:1,def 2
        .= (cods G99)/.y by A38,CAT_3:def 2;
    end;
    then consider h9 being Morphism of C such that
A40: h9 in Hom(d,a) and
A41: for k being Morphism of C st k in Hom(d,a) holds (for y being set
    st y in I\{x} holds (G9/.y)(*)k = G99/.y) iff h9 = k by A14,CAT_3:1;
A42: x in {x} by TARSKI:def 1;
    set g = F99/.x;
A43: dom g = d by A12,CARD_1:27,CAT_3:41;
A44: F9/.x = F9.x by A12,CARD_1:27,FUNCT_2:def 13
      .= (x .-->p2).x by A20,A42,FUNCT_4:13
      .= p2 by A42,FUNCOP_1:7;
    then cod p2 = (cods F9)/.x by A12,CARD_1:27,CAT_3:def 2
      .= cod g by A12,A36,CARD_1:27,CAT_3:def 2;
    then g in Hom(d,cod p2) by A43;
    then consider h being Morphism of C such that
A45: h in Hom(d,c) and
A46: for k being Morphism of C st k in Hom(d,c) holds p1(*)k = h9 & p2(*)k
    = g iff h = k by A17,A19,A40;
    take h;
    thus h in Hom(d,c) by A45;
    let k be Morphism of C such that
A47: k in Hom(d,c);
    thus (for y being set st y in I holds (F9/.y)(*)k = F99/.y) implies h = k
    proof
A48:  cod k = c by A47,CAT_1:1;
      then
A49:  cod(p1(*)k) = a by A15,A17,CAT_1:17;
      assume
A50:  for y being set st y in I holds (F9/.y)(*)k = F99/.y;
A51:  for y being set st y in I\{x} holds (G9/.y)(*)(p1(*)k) = G99/.y
      proof
        let y be set;
        assume
A52:    y in I\{x};
        then
A53:    not y in {x} by XBOOLE_0:def 5;
A54:    F9/.y = F9.y by A52,FUNCT_2:def 13
          .= (G9*p1).y by A20,A22,A52,A53,FUNCT_4:def 1
          .= (G9*p1)/.y by A52,FUNCT_2:def 13;
        dom(G9/.y) = a by A52,CAT_3:41;
        hence (G9/.y)(*)(p1(*)k) = ((G9/.y)(*)p1)(*)k by A15,A17,A48,CAT_1:18
          .= ((G9*p1)/.y)(*)k by A52,CAT_3:def 5
          .= F99/.y by A50,A52,A54
          .= F99.y by A52,FUNCT_2:def 13
          .= G99.y by A52,FUNCT_1:49
          .= G99/.y by A52,FUNCT_2:def 13;
      end;
      dom k = d by A47,CAT_1:1;
      then dom(p1(*)k) = d by A15,A48,CAT_1:17;
      then p1(*)k in Hom(d,a) by A49;
      then
A55:  p1(*)k = h9 by A41,A51;
      p2(*)k = g by A12,A44,A50,CARD_1:27;
      hence thesis by A46,A47,A55;
    end;
    assume
A56: h = k;
    let y be set such that
A57: y in I;
    now
      per cases;
      suppose
A58:    y = x;
        then
A59:    y in {x} by TARSKI:def 1;
        F9/.y = F9.y by A57,FUNCT_2:def 13
          .= (x .-->p2).y by A20,A59,FUNCT_4:13
          .= p2 by A59,FUNCOP_1:7;
        hence thesis by A46,A47,A56,A58;
      end;
      suppose
A60:    y <> x;
        then
A61:    not y in {x} by TARSKI:def 1;
A62:    cod k = c by A47,CAT_1:1;
A63:    y in I\{x} by A57,A60,ZFMISC_1:56;
A64:    dom(G9/.y) = a by A57,A60,CAT_3:41,ZFMISC_1:56;
        F9/.y = F9.y by A57,FUNCT_2:def 13
          .= (G9*p1).y by A20,A22,A57,A61,FUNCT_4:def 1
          .= (G9*p1)/.y by A63,FUNCT_2:def 13
          .= (G9/.y)(*)p1 by A63,CAT_3:def 5;
        hence (F9/.y)(*)k = (G9/.y)(*)(p1(*)k) by A15,A17,A62,A64,CAT_1:18
          .= (G9/.y)(*)h9 by A46,A47,A56
          .= G99/.y by A40,A41,A63
          .= G99.y by A63,FUNCT_2:def 13
          .= F99.y by A57,A60,FUNCT_1:49,ZFMISC_1:56
          .= F99/.y by A57,FUNCT_2:def 13;
      end;
    end;
    hence thesis;
  end;
  let I be finite set, F be Function of I,the carrier of C;
A65: card I = card I;
A66: Q[ 0 ]
  proof
    let I be finite set, F be Function of I,the carrier of C;
    assume card I = 0;
    then
A67: I = {};
    {} is Function of {}, the carrier' of C by RELSET_1:12;
    then reconsider F9 = {} as Projections_family of a,I by A67,CAT_3:42;
    take a,F9;
    for x being set st x in I holds (cods F9)/.x = F/.x;
    hence cods F9 = F by CAT_3:1;
    thus thesis by A8,A67,CAT_3:50;
  end;
  for n being Nat holds Q[n] from NAT_1:sch 2(A66,A10);
  hence thesis by A65;
end;
