let X be finite set ; :: thesis: for C being Subset-Family of X
for B being set st C is (C1) & C is without_proper_subsets & B = { b where b is Subset of X : for K being Subset of X st K in C holds
not K c= b
}
holds
C = candidate-keys (X deps_encl_by B)

let C be Subset-Family of X; :: thesis: for B being set st C is (C1) & C is without_proper_subsets & B = { b where b is Subset of X : for K being Subset of X st K in C holds
not K c= b
}
holds
C = candidate-keys (X deps_encl_by B)

let B be set ; :: thesis: ( C is (C1) & C is without_proper_subsets & B = { b where b is Subset of X : for K being Subset of X st K in C holds
not K c= b
}
implies C = candidate-keys (X deps_encl_by B) )

assume that
A1: C is (C1) and
A2: C is without_proper_subsets and
A3: B = { b where b is Subset of X : for K being Subset of X st K in C holds
not K c= b
}
; :: thesis: C = candidate-keys (X deps_encl_by B)
set F = X deps_encl_by B;
B c= bool X
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in B or x in bool X )
assume x in B ; :: thesis: x in bool X
then ex b being Subset of X st
( x = b & ( for K being Subset of X st K in C holds
not K c= b ) ) by A3;
hence x in bool X ; :: thesis: verum
end;
then reconsider BB = B as Subset-Family of X ;
A4: [#] X = X ;
A5: now
let x be set ; :: thesis: ( x in C implies [x,X] in Maximal_wrt (X deps_encl_by B) )
assume A6: x in C ; :: thesis: [x,X] in Maximal_wrt (X deps_encl_by B)
then reconsider x' = x as Subset of X ;
now
let c be set ; :: thesis: ( c in BB & x' c= c implies X c= c )
assume A7: ( c in BB & x' c= c ) ; :: thesis: X c= c
then ex b being Subset of X st
( c = b & ( for K being Subset of X st K in C holds
not K c= b ) ) by A3;
hence X c= c by A6, A7; :: thesis: verum
end;
then [x',X] in X deps_encl_by B by A4;
then consider a, b being Subset of X such that
A8: [a,b] in Maximal_wrt (X deps_encl_by B) and
A9: [a,b] >= [x',([#] X)] by Th28;
A10: a c= x' by A9, Th15;
X c= b by A9, Th15;
then A11: b = X by XBOOLE_0:def 10;
assume A12: not [x,X] in Maximal_wrt (X deps_encl_by B) ; :: thesis: contradiction
now
let K be Subset of X; :: thesis: ( K in C implies not K c= a )
assume A13: K in C ; :: thesis: not K c= a
assume A14: K c= a ; :: thesis: contradiction
then K c= x' by A10, XBOOLE_1:1;
then K = x' by A2, A6, A13, Def28;
hence contradiction by A8, A10, A11, A12, A14, XBOOLE_0:def 10; :: thesis: verum
end;
then a in BB by A3;
then X c= a by A8, A11, Lm2;
then X = a by XBOOLE_0:def 10;
hence contradiction by A8, A10, A11, A12, XBOOLE_0:def 10; :: thesis: verum
end;
now
let x be set ; :: thesis: ( ( x in C implies x in candidate-keys (X deps_encl_by B) ) & ( x in candidate-keys (X deps_encl_by B) implies x in C ) )
hereby :: thesis: ( x in candidate-keys (X deps_encl_by B) implies x in C ) end;
assume x in candidate-keys (X deps_encl_by B) ; :: thesis: x in C
then consider A being Subset of X such that
A16: x = A and
A17: [A,X] in Maximal_wrt (X deps_encl_by B) ;
A18: for c being set holds
( not c in BB or c = X or not A c= c )
proof
let c be set ; :: thesis: ( not c in BB or c = X or not A c= c )
assume that
A19: c in BB and
A20: not c = X ; :: thesis: not A c= c
consider cb being Subset of X such that
A21: c = cb and
for K being Subset of X st K in C holds
not K c= cb by A3, A19;
assume A c= c ; :: thesis: contradiction
then X c= c by A4, A17, A19, Lm2;
hence contradiction by A20, A21, XBOOLE_0:def 10; :: thesis: verum
end;
assume A22: not x in C ; :: thesis: contradiction
now
given K being Subset of X such that A23: K in C and
A24: K c= A ; :: thesis: contradiction
A25: [K,X] in Maximal_wrt (X deps_encl_by B) by A5, A23;
A26: A ^|^ X,X deps_encl_by B by A17, Def18;
[K,([#] X)] >= [A,([#] X)] by A24, Th15;
hence contradiction by A16, A22, A23, A25, A26, Th29; :: thesis: verum
end;
then A in BB by A3;
then X in BB by A18;
then consider b being Subset of X such that
A27: b = X and
A28: for K being Subset of X st K in C holds
not K c= b by A3;
for K being set holds not K in C by A27, A28;
hence contradiction by A1, XBOOLE_0:def 1; :: thesis: verum
end;
hence C = candidate-keys (X deps_encl_by B) by TARSKI:2; :: thesis: verum