let C be Category; :: thesis: ( C is with_finite_product iff ( ex a being Object of st a is terminal & ( for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 ) ) ) )

thus ( C is with_finite_product implies ( ex a being Object of st a is terminal & ( for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 ) ) ) ) :: thesis: ( ex a being Object of st a is terminal & ( for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 ) ) implies C is with_finite_product )
proof
reconsider F = {} as Function of {} ,the carrier of C by RELSET_1:25;
assume A1: for I being finite set
for F being Function of I,the carrier of C ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' ) ; :: according to CAT_4:def 3 :: thesis: ( ex a being Object of st a is terminal & ( for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 ) ) )

then consider a being Object of , F' being Projections_family of a, {} such that
cods F' = F and
A2: a is_a_product_wrt F' ;
a is terminal by A2, CAT_3:55;
hence ex a being Object of st a is terminal ; :: thesis: for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )

let a, b be Object of ; :: thesis: ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )

set F = 0 ,1 --> a,b;
consider c being Object of , F' being Projections_family of c,{0 ,1} such that
A3: cods F' = 0 ,1 --> a,b and
A4: c is_a_product_wrt F' by A1;
take c ; :: thesis: ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )

take p1 = F' /. 0 ; :: thesis: ex p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )

take p2 = F' /. 1; :: thesis: ( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )
A5: 1 in {0 ,1} by TARSKI:def 2;
then A6: p2 = F' . 1 by FUNCT_2:def 14;
A7: 0 in {0 ,1} by TARSKI:def 2;
hence ( dom p1 = c & dom p2 = c ) by A5, CAT_3:45; :: thesis: ( cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 )
( (0 ,1 --> a,b) /. 0 = a & (0 ,1 --> a,b) /. 1 = b ) by CAT_3:7;
hence ( cod p1 = a & cod p2 = b ) by A3, A7, A5, CAT_3:def 4; :: thesis: c is_a_product_wrt p1,p2
( dom F' = {0 ,1} & p1 = F' . 0 ) by A7, FUNCT_2:def 14, FUNCT_2:def 1;
then F' = 0 ,1 --> p1,p2 by A6, FUNCT_4:69;
hence c is_a_product_wrt p1,p2 by A4, CAT_3:59; :: thesis: verum
end;
given a being Object of such that A8: a is terminal ; :: thesis: ( ex a, b being Object of st
for c being Object of
for p1, p2 being Morphism of holds
( not dom p1 = c or not dom p2 = c or not cod p1 = a or not cod p2 = b or not c is_a_product_wrt p1,p2 ) or C is with_finite_product )

defpred S1[ Nat] means for I being finite set
for F being Function of I,the carrier of C st card I = $1 holds
ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' );
assume A9: for a, b being Object of ex c being Object of ex p1, p2 being Morphism of st
( dom p1 = c & dom p2 = c & cod p1 = a & cod p2 = b & c is_a_product_wrt p1,p2 ) ; :: thesis: C is with_finite_product
A10: for n being Nat st S1[n] holds
S1[n + 1]
proof
let n be Nat; :: thesis: ( S1[n] implies S1[n + 1] )
assume A11: S1[n] ; :: thesis: S1[n + 1]
let I be finite set ; :: thesis: for F being Function of I,the carrier of C st card I = n + 1 holds
ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

let F be Function of I,the carrier of C; :: thesis: ( card I = n + 1 implies ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' ) )

assume A12: card I = n + 1 ; :: thesis: ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

consider x being 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:38;
{x} c= I by A12, CARD_1:47, ZFMISC_1:37;
then card Ix = (card I) - (card sx) by CARD_2:63
.= (card I) - 1 by CARD_1:50
.= n by A12, XCMPLX_1:26 ;
then consider a being Object of , G' being Projections_family of a,I \ {x} such that
A13: cods G' = G and
A14: a is_a_product_wrt G' by A11;
consider c being Object of , p1, p2 being Morphism of 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 F' = (G' * p1) +* (x .--> p2);
A20: dom ({x} --> p2) = {x} by FUNCT_2:def 1;
rng ((G' * p1) +* (x .--> p2)) c= (rng (G' * p1)) \/ (rng (x .--> p2)) by FUNCT_4:18;
then A21: rng ((G' * p1) +* (x .--> p2)) c= the carrier' of C by XBOOLE_1:1;
dom (G' * p1) = I \ {x} by FUNCT_2:def 1;
then A22: (dom (G' * p1)) \/ (dom (x .--> p2)) = I \/ {x} by A20, XBOOLE_1:39
.= I by A12, CARD_1:47, ZFMISC_1:46 ;
then dom ((G' * p1) +* (x .--> p2)) = I by FUNCT_4:def 1;
then reconsider F' = (G' * p1) +* (x .--> p2) as Function of I,the carrier' of C by A21, FUNCT_2:def 1, RELSET_1:11;
A23: doms G' = (I \ {x}) --> a by CAT_3:def 14;
now
let y be set ; :: thesis: ( y in I implies (doms F') . y = (I --> c) . y )
assume A24: y in I ; :: thesis: (doms F') . y = (I --> c) . y
now
per cases ( y = x or y <> x ) ;
suppose y = x ; :: thesis: (I --> c) . y = (doms F') /. y
then A25: y in {x} by TARSKI:def 1;
F' /. y = F' . y by A24, FUNCT_2:def 14
.= (x .--> p2) . y by A20, A25, FUNCT_4:14
.= p2 by A25, FUNCOP_1:13 ;
hence (I --> c) . y = dom (F' /. y) by A16, A24, FUNCOP_1:13
.= (doms F') /. y by A24, CAT_3:def 3 ;
:: thesis: verum
end;
suppose A26: y <> x ; :: thesis: (doms F') /. y = (I --> c) . y
then A27: not y in {x} by TARSKI:def 1;
A28: y in I \ {x} by A24, A26, ZFMISC_1:64;
F' /. y = F' . y by A24, FUNCT_2:def 14
.= (G' * p1) . y by A20, A22, A24, A27, FUNCT_4:def 1
.= (G' * p1) /. y by A28, FUNCT_2:def 14 ;
hence (doms F') /. y = dom ((G' * p1) /. y) by A24, CAT_3:def 3
.= (doms (G' * p1)) /. y by A28, CAT_3:def 3
.= ((I \ {x}) --> c) /. y by A15, A17, A23, CAT_3:20
.= c by A28, CAT_3:2
.= (I --> c) . y by A24, FUNCOP_1:13 ;
:: thesis: verum
end;
end;
end;
hence (doms F') . y = (I --> c) . y by A24, FUNCT_2:def 14; :: thesis: verum
end;
then doms F' = I --> c by FUNCT_2:18;
then reconsider F' = F' as Projections_family of c,I by CAT_3:def 14;
take c ; :: thesis: ex F' being Projections_family of c,I st
( cods F' = F & c is_a_product_wrt F' )

take F' ; :: thesis: ( cods F' = F & c is_a_product_wrt F' )
now
let y be set ; :: thesis: ( y in I implies (cods F') /. y = F /. y )
assume A29: y in I ; :: thesis: (cods F') /. y = F /. y
now
per cases ( y = x or y <> x ) ;
suppose A30: y = x ; :: thesis: (cods F') /. y = F /. y
then A31: y in {x} by TARSKI:def 1;
F' /. y = F' . y by A29, FUNCT_2:def 14
.= (x .--> p2) . y by A20, A31, FUNCT_4:14
.= p2 by A31, FUNCOP_1:13 ;
hence (cods F') /. y = F /. y by A18, A29, A30, CAT_3:def 4; :: thesis: verum
end;
suppose A32: y <> x ; :: thesis: (cods F') /. y = F /. y
then A33: not y in {x} by TARSKI:def 1;
A34: y in I \ {x} by A29, A32, ZFMISC_1:64;
F' /. y = F' . y by A29, FUNCT_2:def 14
.= (G' * p1) . y by A20, A22, A29, A33, FUNCT_4:def 1
.= (G' * p1) /. y by A34, FUNCT_2:def 14 ;
hence (cods F') /. y = cod ((G' * p1) /. y) by A29, CAT_3:def 4
.= (cods (G' * p1)) /. y by A34, CAT_3:def 4
.= G /. y by A13, A17, A23, CAT_3:20
.= G . y by A34, FUNCT_2:def 14
.= F . y by A34, FUNCT_1:72
.= F /. y by A29, FUNCT_2:def 14 ;
:: thesis: verum
end;
end;
end;
hence (cods F') /. y = F /. y ; :: thesis: verum
end;
hence A35: cods F' = F by CAT_3:1; :: thesis: c is_a_product_wrt F'
thus F' is Projections_family of c,I ; :: according to CAT_3:def 15 :: thesis: for b1 being Element of the carrier of C
for b2 being Projections_family of b1,I holds
( not cods F' = cods b2 or ex b3 being Element of the carrier' of C st
( b3 in Hom b1,c & ( for b4 being Element of the carrier' of C holds
( not b4 in Hom b1,c or ( ( ex b5 being set st
( b5 in I & not (F' /. b5) * b4 = b2 /. b5 ) or b3 = b4 ) & ( not b3 = b4 or for b5 being set holds
( not b5 in I or (F' /. b5) * b4 = b2 /. b5 ) ) ) ) ) ) )

let d be Object of ; :: thesis: for b1 being Projections_family of d,I holds
( not cods F' = cods b1 or ex b2 being Element of the carrier' of C st
( b2 in Hom d,c & ( for b3 being Element of the carrier' of C holds
( not b3 in Hom d,c or ( ( ex b4 being set st
( b4 in I & not (F' /. b4) * b3 = b1 /. b4 ) or b2 = b3 ) & ( not b2 = b3 or for b4 being set holds
( not b4 in I or (F' /. b4) * b3 = b1 /. b4 ) ) ) ) ) ) )

let F'' be Projections_family of d,I; :: thesis: ( not cods F' = cods F'' or ex b1 being Element of the carrier' of C st
( b1 in Hom d,c & ( for b2 being Element of the carrier' of C holds
( not b2 in Hom d,c or ( ( ex b3 being set st
( b3 in I & not (F' /. b3) * b2 = F'' /. b3 ) or b1 = b2 ) & ( not b1 = b2 or for b3 being set holds
( not b3 in I or (F' /. b3) * b2 = F'' /. b3 ) ) ) ) ) ) )

assume A36: cods F' = cods F'' ; :: thesis: ex b1 being Element of the carrier' of C st
( b1 in Hom d,c & ( for b2 being Element of the carrier' of C holds
( not b2 in Hom d,c or ( ( ex b3 being set st
( b3 in I & not (F' /. b3) * b2 = F'' /. b3 ) or b1 = b2 ) & ( not b1 = b2 or for b3 being set holds
( not b3 in I or (F' /. b3) * b2 = F'' /. b3 ) ) ) ) ) )

reconsider G'' = F'' | (I \ {x}) as Function of I \ {x},the carrier' of C by FUNCT_2:38;
now
let y be set ; :: thesis: ( y in I \ {x} implies (doms G'') /. y = ((I \ {x}) --> d) /. y )
assume A37: y in I \ {x} ; :: thesis: (doms G'') /. y = ((I \ {x}) --> d) /. y
then G'' /. y = G'' . y by FUNCT_2:def 14
.= F'' . y by A37, FUNCT_1:72
.= F'' /. y by A37, FUNCT_2:def 14 ;
hence (doms G'') /. y = dom (F'' /. y) by A37, CAT_3:def 3
.= d by A37, CAT_3:45
.= ((I \ {x}) --> d) /. y by A37, CAT_3:2 ;
:: thesis: verum
end;
then doms G'' = (I \ {x}) --> d by CAT_3:1;
then reconsider G'' = G'' as Projections_family of d,I \ {x} by CAT_3:def 14;
now
let y be set ; :: thesis: ( y in I \ {x} implies (cods G') /. y = (cods G'') /. y )
assume A38: y in I \ {x} ; :: thesis: (cods G') /. y = (cods G'') /. y
then A39: G /. y = G . y by FUNCT_2:def 14
.= F . y by A38, FUNCT_1:72
.= F /. y by A38, FUNCT_2:def 14 ;
F'' /. y = F'' . y by A38, FUNCT_2:def 14
.= G'' . y by A38, FUNCT_1:72
.= G'' /. y by A38, FUNCT_2:def 14 ;
hence (cods G') /. y = cod (G'' /. y) by A13, A35, A36, A38, A39, CAT_3:def 4
.= (cods G'') /. y by A38, CAT_3:def 4 ;
:: thesis: verum
end;
then cods G' = cods G'' by CAT_3:1;
then consider h' being Morphism of such that
A40: h' in Hom d,a and
A41: for k being Morphism of st k in Hom d,a holds
( ( for y being set st y in I \ {x} holds
(G' /. y) * k = G'' /. y ) iff h' = k ) by A14, CAT_3:def 15;
A42: x in {x} by TARSKI:def 1;
set g = F'' /. x;
A43: dom (F'' /. x) = d by A12, CARD_1:47, CAT_3:45;
A44: F' /. x = F' . x by A12, CARD_1:47, FUNCT_2:def 14
.= (x .--> p2) . x by A20, A42, FUNCT_4:14
.= p2 by A42, FUNCOP_1:13 ;
then cod p2 = (cods F') /. x by A12, CARD_1:47, CAT_3:def 4
.= cod (F'' /. x) by A12, A36, CARD_1:47, CAT_3:def 4 ;
then F'' /. x in Hom d,(cod p2) by A43;
then consider h being Morphism of such that
A45: h in Hom d,c and
A46: for k being Morphism of st k in Hom d,c holds
( ( p1 * k = h' & p2 * k = F'' /. x ) iff h = k ) by A17, A19, A40, CAT_3:def 16;
take h ; :: thesis: ( h in Hom d,c & ( for b1 being Element of the carrier' of C holds
( not b1 in Hom d,c or ( ( ex b2 being set st
( b2 in I & not (F' /. b2) * b1 = F'' /. b2 ) or h = b1 ) & ( not h = b1 or for b2 being set holds
( not b2 in I or (F' /. b2) * b1 = F'' /. b2 ) ) ) ) ) )

thus h in Hom d,c by A45; :: thesis: for b1 being Element of the carrier' of C holds
( not b1 in Hom d,c or ( ( ex b2 being set st
( b2 in I & not (F' /. b2) * b1 = F'' /. b2 ) or h = b1 ) & ( not h = b1 or for b2 being set holds
( not b2 in I or (F' /. b2) * b1 = F'' /. b2 ) ) ) )

let k be Morphism of ; :: thesis: ( not k in Hom d,c or ( ( ex b1 being set st
( b1 in I & not (F' /. b1) * k = F'' /. b1 ) or h = k ) & ( not h = k or for b1 being set holds
( not b1 in I or (F' /. b1) * k = F'' /. b1 ) ) ) )

assume A47: k in Hom d,c ; :: thesis: ( ( ex b1 being set st
( b1 in I & not (F' /. b1) * k = F'' /. b1 ) or h = k ) & ( not h = k or for b1 being set holds
( not b1 in I or (F' /. b1) * k = F'' /. b1 ) ) )

thus ( ( for y being set st y in I holds
(F' /. y) * k = F'' /. y ) implies h = k ) :: thesis: ( not h = k or for b1 being set holds
( not b1 in I or (F' /. b1) * k = F'' /. b1 ) )
proof
A48: cod k = c by A47, CAT_1:18;
then A49: cod (p1 * k) = a by A15, A17, CAT_1:42;
assume A50: for y being set st y in I holds
(F' /. y) * k = F'' /. y ; :: thesis: h = k
A51: for y being set st y in I \ {x} holds
(G' /. y) * (p1 * k) = G'' /. y
proof
let y be set ; :: thesis: ( y in I \ {x} implies (G' /. y) * (p1 * k) = G'' /. y )
assume A52: y in I \ {x} ; :: thesis: (G' /. y) * (p1 * k) = G'' /. y
then A53: not y in {x} by XBOOLE_0:def 5;
A54: F' /. y = F' . y by A52, FUNCT_2:def 14
.= (G' * p1) . y by A20, A22, A52, A53, FUNCT_4:def 1
.= (G' * p1) /. y by A52, FUNCT_2:def 14 ;
dom (G' /. y) = a by A52, CAT_3:45;
hence (G' /. y) * (p1 * k) = ((G' /. y) * p1) * k by A15, A17, A48, CAT_1:43
.= ((G' * p1) /. y) * k by A52, CAT_3:def 7
.= F'' /. y by A50, A52, A54
.= F'' . y by A52, FUNCT_2:def 14
.= G'' . y by A52, FUNCT_1:72
.= G'' /. y by A52, FUNCT_2:def 14 ;
:: thesis: verum
end;
dom k = d by A47, CAT_1:18;
then dom (p1 * k) = d by A15, A48, CAT_1:42;
then p1 * k in Hom d,a by A49;
then A55: p1 * k = h' by A41, A51;
p2 * k = F'' /. x by A12, A44, A50, CARD_1:47;
hence h = k by A46, A47, A55; :: thesis: verum
end;
assume A56: h = k ; :: thesis: for b1 being set holds
( not b1 in I or (F' /. b1) * k = F'' /. b1 )

let y be set ; :: thesis: ( not y in I or (F' /. y) * k = F'' /. y )
assume A57: y in I ; :: thesis: (F' /. y) * k = F'' /. y
now
per cases ( y = x or y <> x ) ;
suppose A58: y = x ; :: thesis: (F' /. y) * k = F'' /. y
then A59: y in {x} by TARSKI:def 1;
F' /. y = F' . y by A57, FUNCT_2:def 14
.= (x .--> p2) . y by A20, A59, FUNCT_4:14
.= p2 by A59, FUNCOP_1:13 ;
hence (F' /. y) * k = F'' /. y by A46, A47, A56, A58; :: thesis: verum
end;
suppose A60: y <> x ; :: thesis: (F' /. y) * k = F'' /. y
then A61: not y in {x} by TARSKI:def 1;
A62: cod k = c by A47, CAT_1:18;
A63: y in I \ {x} by A57, A60, ZFMISC_1:64;
then A64: dom (G' /. y) = a by CAT_3:45;
F' /. y = F' . y by A57, FUNCT_2:def 14
.= (G' * p1) . y by A20, A22, A57, A61, FUNCT_4:def 1
.= (G' * p1) /. y by A63, FUNCT_2:def 14
.= (G' /. y) * p1 by A63, CAT_3:def 7 ;
hence (F' /. y) * k = (G' /. y) * (p1 * k) by A15, A17, A62, A64, CAT_1:43
.= (G' /. y) * h' by A46, A47, A56
.= G'' /. y by A40, A41, A63
.= G'' . y by A63, FUNCT_2:def 14
.= F'' . y by A63, FUNCT_1:72
.= F'' /. y by A57, FUNCT_2:def 14 ;
:: thesis: verum
end;
end;
end;
hence (F' /. y) * k = F'' /. y ; :: thesis: verum
end;
let I be finite set ; :: according to CAT_4:def 3 :: thesis: for F being Function of I,the carrier of C ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

let F be Function of I,the carrier of C; :: thesis: ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

A65: card I = card I ;
A66: S1[ 0 ]
proof
let I be finite set ; :: thesis: for F being Function of I,the carrier of C st card I = 0 holds
ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

let F be Function of I,the carrier of C; :: thesis: ( card I = 0 implies ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' ) )

assume card I = 0 ; :: thesis: ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

then A67: I = {} ;
{} is Function of {} ,the carrier' of C by RELSET_1:25;
then reconsider F' = {} as Projections_family of a,I by A67, CAT_3:46;
take a ; :: thesis: ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' )

take F' ; :: thesis: ( cods F' = F & a is_a_product_wrt F' )
for x being set st x in I holds
(cods F') /. x = F /. x ;
hence cods F' = F by CAT_3:1; :: thesis: a is_a_product_wrt F'
thus a is_a_product_wrt F' by A8, A67, CAT_3:55; :: thesis: verum
end;
for n being Nat holds S1[n] from NAT_1:sch 2(A66, A10);
hence ex a being Object of ex F' being Projections_family of a,I st
( cods F' = F & a is_a_product_wrt F' ) by A65; :: thesis: verum