
theorem :: WWA6a A more reasonable version
  for X being finite set, C being Subset-Family of X, B being set st C
is (C1) (C2) & 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)
proof
  let X be finite set, C be Subset-Family of X, B be set such that
A1: C is (C1) and
A2: C is (C2) 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};
  B c= bool X
  proof
    let x be object;
    assume x in B;
    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 thesis;
  end;
  then reconsider BB = B as Subset-Family of X;
  set F = X deps_encl_by B;
A4: [#]X = X;
A5: now
    let x be set;
    assume
A6: x in C;
    then reconsider x9 = x as Subset of X;
    now
      let c be set;
      assume that
A7:   c in BB and
A8:   x9 c= c;
      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,A7;
      hence X c= c by A6,A8;
    end;
    then [x9,X] in F by A4;
    then consider a, b being Subset of X such that
A9: [a,b] in Maximal_wrt F and
A10: [a, b] >= [x9,[#]X] by Th26;
A11: a c= x9 by A10;
    X c= b by A10;
    then
A12: b = X by XBOOLE_0:def 10;
    assume
A13: not [x,X] in Maximal_wrt F;
    now
      let K be Subset of X;
      assume
A14:  K in C;
      assume
A15:  K c= a;
      then K c= x9 by A11;
      then K = x9 by A2,A6,A14;
      hence contradiction by A9,A11,A12,A13,A15,XBOOLE_0:def 10;
    end;
    then a in BB by A3;
    then X c= a by A9,A12,Lm3;
    then X = a by XBOOLE_0:def 10;
    hence contradiction by A9,A11,A12,A13,XBOOLE_0:def 10;
  end;
  now
    let x be object;
    hereby
      assume
A16:  x in C;
      then [x,X] in Maximal_wrt F by A5;
      hence x in candidate-keys F by A16;
    end;
    assume x in candidate-keys F;
    then consider A being Subset of X such that
A17: x = A and
A18: [A, X] in Maximal_wrt F;
    assume
A19: not x in C;
    now
A20:  A ^|^ X, F by A18;
      given K being Subset of X such that
A21:  K in C and
A22:  K c= A;
A23:  [K, [#]X] >= [A, [#]X] by A22;
      [K,X] in Maximal_wrt F by A5,A21;
      hence contradiction by A17,A19,A21,A20,A23,Th27;
    end;
    then
A24: A in BB by A3;
    for c being set st c in BB holds c = X or not A c= c
    proof
      let c be set;
      assume that
A25:  c in BB and
A26:  not c = X;
      assume A c= c;
      then X c= c by A4,A18,A25,Lm3;
      hence contradiction by A25,A26,XBOOLE_0:def 10;
    end;
    then X in BB by A24;
    then
    ex b being Subset of X st b = X & for K being Subset of X st K in C
    holds not K c= b by A3;
    then not ex K being object st K in C;
    hence contradiction by A1,XBOOLE_0:def 1;
  end;
  hence thesis by TARSKI:2;
end;
