let X be set ; :: thesis: for P being finite a_partition of X
for S being Subset of X holds
( ( for p being set st p in P holds
p meets S ) iff card (P | S) = card P )

let P be finite a_partition of X; :: thesis: for S being Subset of X holds
( ( for p being set st p in P holds
p meets S ) iff card (P | S) = card P )

let S be Subset of X; :: thesis: ( ( for p being set st p in P holds
p meets S ) iff card (P | S) = card P )

per cases ( X = {} or X <> {} ) ;
suppose S1: X = {} ; :: thesis: ( ( for p being set st p in P holds
p meets S ) iff card (P | S) = card P )

hereby :: thesis: ( card (P | S) = card P implies for p being set st p in P holds
p meets S )
assume for p being set st p in P holds
p meets S ; :: thesis: card (P | S) = card P
S = {} by S1;
hence card (P | S) = {} by CARD_1:47, EQREL_1:41
.= card P by S1, EQREL_1:41, CARD_1:47 ;
:: thesis: verum
end;
thus ( card (P | S) = card P implies for p being set st p in P holds
p meets S ) by S1, EQREL_1:41; :: thesis: verum
end;
suppose S1: X <> {} ; :: thesis: ( ( for p being set st p in P holds
p meets S ) iff card (P | S) = card P )

set PS = P | S;
reconsider Pp1 = P as non empty finite set by S1;
hereby :: thesis: ( card (P | S) = card P implies for p being set st p in P holds
p meets S )
assume A1: for p being set st p in P holds
p meets S ; :: thesis: card (P | S) = card P
consider p being Element of P;
p in Pp1 ;
then p meets S by A1;
then p /\ S in P | S ;
then reconsider PSp1 = P | S as non empty finite set ;
defpred S1[ set , set ] means ( $1 in P & $2 = $1 /\ S );
P: for x being set st x in P holds
ex y being set st
( y in PSp1 & S1[x,y] )
proof
let x be set ; :: thesis: ( x in P implies ex y being set st
( y in PSp1 & S1[x,y] ) )

assume A2: x in P ; :: thesis: ex y being set st
( y in PSp1 & S1[x,y] )

take x /\ S ; :: thesis: ( x /\ S in PSp1 & S1[x,x /\ S] )
x meets S by A2, A1;
hence ( x /\ S in PSp1 & S1[x,x /\ S] ) by A2; :: thesis: verum
end;
consider f being Function of P,PSp1 such that
Q: for x being set st x in P holds
S1[x,f . x] from FUNCT_2:sch 1(P);
now
let x1, x2 be set ; :: thesis: ( x1 in P & x2 in P & f . x1 = f . x2 implies x1 = x2 )
assume that
A2: x1 in P and
B2: x2 in P and
C2: f . x1 = f . x2 ; :: thesis: x1 = x2
F2: f . x1 = x1 /\ S by A2, Q;
G2: f . x2 = x2 /\ S by B2, Q;
x1 meets S by A2, A1;
then f . x1 in P | S by F2, A2;
then f . x1 <> {} by EQREL_1:def 6;
then consider x being set such that
H2: x in f . x1 by XBOOLE_0:def 1;
( x in x1 & x in x2 ) by H2, C2, F2, G2, XBOOLE_0:def 4;
then x1 meets x2 by XBOOLE_0:3;
hence x1 = x2 by A2, B2, EQREL_1:def 6; :: thesis: verum
end;
then R: f is one-to-one by FUNCT_2:25;
rng f = PSp1
proof
thus rng f c= PSp1 :: according to XBOOLE_0:def 10 :: thesis: PSp1 c= rng f
proof
let y be set ; :: according to TARSKI:def 3 :: thesis: ( not y in rng f or y in PSp1 )
assume y in rng f ; :: thesis: y in PSp1
then consider x being set such that
A2: x in P and
B2: f . x = y by FUNCT_2:17;
x meets S by A1, A2;
then x /\ S in P | S by A2;
hence y in PSp1 by B2, A2, Q; :: thesis: verum
end;
thus PSp1 c= rng f :: thesis: verum
proof
let y be set ; :: according to TARSKI:def 3 :: thesis: ( not y in PSp1 or y in rng f )
assume y in PSp1 ; :: thesis: y in rng f
then consider p being Element of P such that
A2: y = p /\ S and
p meets S ;
C2: p in Pp1 ;
then f . p = p /\ S by Q;
hence y in rng f by A2, C2, FUNCT_2:6; :: thesis: verum
end;
end;
then f is onto by FUNCT_2:def 3;
hence card (P | S) = card P by R, EULER_1:12; :: thesis: verum
end;
assume A1: card (P | S) = card P ; :: thesis: for p being set st p in P holds
p meets S

defpred S1[ set , set ] means ( $1 in P | S & $2 in Pp1 & $1 = $2 /\ S );
P: for x being set st x in P | S holds
ex y being set st
( y in Pp1 & S1[x,y] )
proof
let x be set ; :: thesis: ( x in P | S implies ex y being set st
( y in Pp1 & S1[x,y] ) )

assume A0: x in P | S ; :: thesis: ex y being set st
( y in Pp1 & S1[x,y] )

then consider p being Element of P such that
A1: x = p /\ S and
p meets S ;
take p ; :: thesis: ( p in Pp1 & S1[x,p] )
thus ( p in Pp1 & S1[x,p] ) by A0, A1; :: thesis: verum
end;
consider f being Function of (P | S),Pp1 such that
Q: for x being set st x in P | S holds
S1[x,f . x] from FUNCT_2:sch 1(P);
R: f is one-to-one
proof
let x1, x2 be set ; :: according to FUNCT_1:def 8 :: thesis: ( not x1 in proj1 f or not x2 in proj1 f or not f . x1 = f . x2 or x1 = x2 )
assume that
A1: x1 in dom f and
B1: x2 in dom f and
C1: f . x1 = f . x2 ; :: thesis: x1 = x2
x1 = (f . x1) /\ S by A1, Q;
hence x1 = x2 by C1, B1, Q; :: thesis: verum
end;
S: rng f = P by A1, R, FINSEQ_4:78;
let p be set ; :: thesis: ( p in P implies p meets S )
assume p in P ; :: thesis: p meets S
then consider ps being set such that
T: ps in dom f and
U: p = f . ps by S, FUNCT_1:def 5;
Ua: dom f = P | S by FUNCT_2:def 1;
V: ps = p /\ S by U, T, Q;
not ps is empty by T, Ua, EQREL_1:def 6;
then ex x being set st x in ps by XBOOLE_0:def 1;
hence p meets S by V, XBOOLE_0:4; :: thesis: verum
end;
end;