
theorem
  for X being non empty finite set, F being Full-family of X ex R being
  DB-Rel st the Attributes of R = X & (for a being Element of X holds (the
  Domains of R).a = INT) & F = Dependency-str R
proof
  let X be non empty finite set, F be Full-family of X;
  reconsider D = X --> INT as non-empty ManySortedSet of X;
  consider G being Subset-Family of X such that
  G is_generator-set_of saturated-subsets F and
A1: F = X deps_encl_by G by Th43;
  consider H being FinSequence such that
A2: rng H = G and
  H is one-to-one by FINSEQ_4:58;
A4: now
    set f = X --> 0;
    thus dom f = dom D;
    let x be object;
    assume
A5: x in dom D;
    then f.x = 0 by FUNCOP_1:7;
    then f.x in NAT;
    then f.x in INT by NUMBERS:17;
    hence f.x in D.x by A5,FUNCOP_1:7;
  end;
  then
A6: X --> 0 is Element of product D by CARD_3:def 5;
  reconsider H as FinSequence of G by A2,FINSEQ_1:def 4;
  per cases;
  suppose
A7: G is empty;
    set R = {X-->0};
    R c= product D
    proof
      let x be object;
      assume x in R;
      then x = X --> 0 by TARSKI:def 1;
      hence thesis by A4,CARD_3:def 5;
    end;
    then reconsider R as non empty Subset of product D;
    set BD = DB-Rel (# X, D, R #);
    take BD;
    thus the Attributes of BD = X & for a being Element of X holds (the
    Domains of BD).a = INT;
    set Ds = Dependency-str BD;
    now
      let x be object;
      hereby
        assume x in F;
        then consider A, B being Subset of X such that
A8:     x = [A, B] and
        for g being set st g in G & A c= g holds B c= g by A1;
        reconsider A, B as Subset of the Attributes of BD;
        A >|> B, BD
        proof
          let f, g be Element of the Relationship of BD;
          f = X --> 0 by TARSKI:def 1;
          hence thesis by TARSKI:def 1;
        end;
        hence x in Ds by A8;
      end;
      assume x in Ds;
      then consider A, B being Subset of the Attributes of BD such that
A9:   x = [A,B] and
      A >|> B, BD;
      for g being set st g in G & A c= g holds B c= g by A7;
      hence x in F by A1,A9;
    end;
    hence thesis by TARSKI:2;
  end;
  suppose
A10: G is non empty;
    then H is non empty by A2;
    then reconsider n =len H as non zero Element of NAT;
    defpred R[set,Element of n-tuples_on BOOLEAN ] means
     for i being Element
    of NAT st i in Seg n holds ($1 in H.i implies ($2).i = 0) & (not $1 in H.i
    implies ($2).i = 1);
A11: now
      let x be Element of X;
      defpred P[set,set] means (x in H.$1 implies $2 = 0) & (not x in H.$1
      implies $2 = 1);
A12:  for i being Nat st i in Seg n ex x being Element of BOOLEAN st P[i, x]
      proof
        let i be Nat;
        assume i in Seg n;
        per cases;
        suppose
A13:      x in H.i;
          reconsider b = FALSE as Element of BOOLEAN;
          take b;
          thus thesis by A13;
        end;
        suppose
A14:      not x in H.i;
          reconsider b = TRUE as Element of BOOLEAN;
          take b;
          thus thesis by A14;
        end;
      end;
      consider y being FinSequence of BOOLEAN such that
A15:  dom y = Seg n and
A16:  for i being Nat st i in Seg n holds P[i,y.i] from FINSEQ_1:sch
      5(A12 );
A17:  y in BOOLEAN* by FINSEQ_1:def 11;
      len y = n by A15,FINSEQ_1:def 3;
      then y in { s where s is Element of BOOLEAN*: len s = n } by A17;
      then reconsider y as Element of n-tuples_on BOOLEAN;
      take y;
      thus R[x,y] by A16;
    end;
    consider M being Function of X, n-tuples_on BOOLEAN such that
A18: for x being Element of X holds R[x,(M.x) qua Element of n
    -tuples_on BOOLEAN] from FUNCT_2:sch 3(A11);
    set R = {f where f is Element of product D : ex i being Element of NAT st
for x being Element of X holds f.x = Absval ((n-BinarySequence i)
 '&' (M.x qua Element of n-tuples_on BOOLEAN)) };
A19: R c= product D
    proof
      let x be object;
      assume x in R;
      then ex f being Element of product D st x = f & ex i being Element of
NAT st for x being Element of X holds f.x = Absval ((n-BinarySequence i) '&' (M
      .x qua Element of n-tuples_on BOOLEAN));
      hence thesis;
    end;
    now
      take i = 0;
      set f = X --> 0;
      let x be Element of X;
A20:  (n-BinarySequence i) '&' (M.x qua Element of n-tuples_on BOOLEAN)
 = n-BinarySequence i by Th5
        .= 0*n by BINARI_3:25;
      thus f.x = 0
        .= Absval ((n-BinarySequence i) '&' (M.x
        qua Element of n-tuples_on BOOLEAN)) by A20,BINARI_3:6;
    end;
    then X --> 0 in R by A6;
    then reconsider R as non empty Subset of product D by A19;
    set BD = DB-Rel (# X, D, R #);
    take BD;
    thus the Attributes of BD = X & for a being Element of X holds (the
    Domains of BD).a = INT;
    set Ds = Dependency-str BD;
A21: dom H = Seg n by FINSEQ_1:def 3;
    now
      let x be object;
      hereby
        assume x in F;
        then consider A, B being Subset of X such that
A22:    x = [A, B] and
A23:    for g being set st g in G & A c= g holds B c= g by A1;
        reconsider A9 = A, B9 = B as Subset of the Attributes of BD;
        A9 >|> B9, BD
        proof
          let f, g be Element of the Relationship of BD;
          assume
A24:      f|A9 = g|A9;
          f in R;
          then consider Rf being Element of product D such that
A25:      f = Rf and
A26:      ex i being Element of NAT st for x being Element of X holds
          Rf.x = Absval ((n-BinarySequence i) '&' (M.x
           qua Element of n-tuples_on BOOLEAN));
          consider fi being Element of NAT such that
A27:      for x being Element of X holds Rf.x = Absval ((n
          -BinarySequence fi) '&' (M.x qua Element of n-tuples_on BOOLEAN))
           by A26;
          g in R;
          then consider Rg being Element of product D such that
A28:      g = Rg and
A29:      ex i being Element of NAT st for x being Element of X holds
          Rg.x = Absval ((n-BinarySequence i) '&' (M.x
           qua Element of n-tuples_on BOOLEAN));
          consider gi being Element of NAT such that
A30:      for x being Element of X holds Rg.x = Absval ((n
          -BinarySequence gi) '&' (M.x
           qua Element of n-tuples_on BOOLEAN)) by A29;
A31:      dom g = dom D by A28,CARD_3:9
            .= dom f by A25,CARD_3:9;
          now
            set nbg = n-BinarySequence gi;
            set nbf = n-BinarySequence fi;
            thus
A32:        dom (g|B) = dom f /\ B by A31,RELAT_1:61;
            let a be object such that
A33:        a in dom (g|B);
            reconsider x = a as Element of X by A32,A33;
            reconsider Mx = M.x as Tuple of n, BOOLEAN;
            set ng = nbg '&' (M.x qua Element of n-tuples_on BOOLEAN);
            set nf = nbf '&' (M.x qua Element of n-tuples_on BOOLEAN);
A34:        dom (M.x qua Element of n-tuples_on BOOLEAN) = Seg n by Lm2;
A35:        dom nf = Seg n by Lm1;
A36:        a in B by A32,A33,XBOOLE_0:def 4;
            now
              thus dom nf = dom ng by A35,Lm1;
              let i be object;
              assume
A37:          i in dom nf;
              per cases;
              suppose
                A c= H.i;
                then
A38:            B c= H.i by A2,A21,A23,A35,A37,FUNCT_1:3;
A39:            Mx/.i = Mx.i by A34,A35,A37,PARTFUN1:def 6
                  .= 0 by A18,A36,A35,A37,A38;
                thus nf.i = (nbf/.i) '&' (Mx/.i) by A35,A37,Def5
                  .= (nbg/.i) '&' (Mx/.i) by A39
                  .= ng.i by A35,A37,Def5;
              end;
              suppose
A40:            not A c= H.i;
                thus nf.i = ng.i
                proof
                  consider xx being object such that
A41:              xx in A and
A42:              not xx in H.i by A40;
                  reconsider xx as Element of X by A41;
A43:              f.xx = (g|A).xx by A24,A41,FUNCT_1:49
                    .= g.xx by A41,FUNCT_1:49;
                  reconsider Mxx = M.xx as Tuple of n, BOOLEAN;
A44:              f.xx = Absval (nbf '&' (M.xx
 qua Element of n-tuples_on BOOLEAN)) by A25,A27;
A45:              g.xx = Absval ((nbg) '&' (M.xx
 qua Element of n-tuples_on BOOLEAN)) by A28,A30;
                  dom (M.xx
                  qua Element of n-tuples_on BOOLEAN) = Seg n by Lm2;
                  then
A46:              Mxx/.i = Mxx.i by A35,A37,PARTFUN1:def 6
                    .= 1 by A18,A35,A37,A42;
                  then
A47:              nbf/.i = (nbf/.i) '&' (Mxx/.i) .= (nbf '&' (M.xx
                     qua Element of n-tuples_on BOOLEAN)).i by A35,A37,Def5
                    .= (nbg '&' (M.xx
                     qua Element of n-tuples_on BOOLEAN)).i
                      by A43,A44,A45,BINARI_3:2
                    .= (nbg/.i) '&' (Mxx/.i) by A35,A37,Def5
                    .= nbg/.i by A46;
                  thus nf.i = (nbf/.i) '&' (Mx/.i) by A35,A37,Def5
                    .= ng.i by A35,A37,A47,Def5;
                end;
              end;
            end;
            then nf = ng by FUNCT_1:2;
            then g.a = Absval ((n-BinarySequence fi) '&' (M.x
             qua Element of n-tuples_on BOOLEAN)) by A28,A30
              .= f.a by A25,A27;
            hence (g|B).a = f.a by A33,FUNCT_1:47;
          end;
          hence thesis by FUNCT_1:46;
        end;
        hence x in Ds by A22;
      end;
      assume x in Ds;
      then consider A, B being Subset of the Attributes of BD such that
A48:  x = [A, B] and
A49:  A >|> B, BD;
      now
        deffunc F(Element of X) = Absval ((n-BinarySequence 0) '&' (M.$1
         qua Element of n-tuples_on BOOLEAN));
        let gg be set such that
A50:    gg in G and
A51:    A c= gg and
A52:    not B c= gg;
        reconsider gg as Element of G by A50;
        consider f being Function of X, NAT such that
A53:    for x being Element of X holds f.x = F(x) from FUNCT_2:sch 4;
A54:    now
          let x be object;
          assume x in dom D;
          then reconsider x9 = x as Element of X;
          f.x9 in INT by NUMBERS:17;
          hence f.x in D.x;
        end;
A55:    dom f = dom D by FUNCT_2:def 1;
        then reconsider f as Element of product D by A54,CARD_3:def 5;
        consider i being Nat such that
A56:    i in dom H and
A57:    H.i = gg by A2,A10,FINSEQ_2:10;
        i <> 0 by A21,A56,FINSEQ_1:1;
        then consider k being Nat such that
A58:    i = k+1 by NAT_1:6;
        consider bx being object such that
A59:    bx in B and
A60:    not bx in gg by A52;
        reconsider bx as Element of X by A59;
        reconsider Mbx = M.bx as Tuple of n, BOOLEAN;
A61:    f in R by A53;
        dom Mbx = Seg n by Lm1;
        then
A62:    Mbx/.i = Mbx.i by A21,A56,PARTFUN1:def 6
          .= 1 by A21,A18,A60,A56,A57;
        reconsider k as Element of NAT by ORDINAL1:def 12;
        deffunc F(Element of X) = Absval ((n-BinarySequence 2 to_power k) '&'
        (M.$1 qua Element of n-tuples_on BOOLEAN));
        consider g being Function of X, NAT such that
A63:    for x being Element of X holds g.x = F(x) from FUNCT_2:sch 4;
A64:    now
          let x be object;
          assume x in dom D;
          then reconsider x9 = x as Element of X;
          g.x9 in INT by NUMBERS:17;
          hence g.x in D.x;
        end;
A65:    dom g = dom D by FUNCT_2:def 1;
        then reconsider g as Element of product D by A64,CARD_3:def 5;
        i <= n by A21,A56,FINSEQ_1:1;
        then
A66:    k < n by A58,NAT_1:13;
        now
          thus
A67:      dom (f|A) = dom g /\ A by A55,A65,RELAT_1:61;
          let x be object;
          assume
A68:      x in dom (f|A);
          then reconsider a = x as Element of X by A67;
          set bs0 = n-BinarySequence 0, bsi = n-BinarySequence 2 to_power k;
A69:      g.a = Absval (bsi '&' (M.a
 qua Element of n-tuples_on BOOLEAN)) by A63;
          set L = bs0 '&' (M.a
           qua Element of n-tuples_on BOOLEAN), R = bsi '&' (M.a
           qua Element of n-tuples_on BOOLEAN);
          reconsider Ma = M.a as Tuple of n, BOOLEAN;
A70:      x in A by A68;
A71:      now
            thus dom L = Seg n by Lm1
              .= dom R by Lm1;
            let j be object;
A72:        bs0 = 0*n by BINARI_3:25
              .= n |-> 0 by EUCLID:def 4;
            assume
A73:        j in dom L;
            then reconsider nj = j as Element of NAT;
A74:        j in Seg n by A73,Lm1;
            dom bs0 = Seg n by Lm1;
            then
A75:        bs0/.nj = bs0.nj by A74,PARTFUN1:def 6
              .= 0 by A72;
A76:        L.j = (bs0/.nj) '&' (Ma/.nj) by A74,Def5
              .= 0 by A75;
            per cases;
            suppose
A77:          i <> nj;
              dom bsi = Seg n by Lm1;
              then
A78:          bsi/.nj = bsi.nj by A74,PARTFUN1:def 6
                .= FALSE by A58,A66,A74,A77,Th7;
              R.j = (bsi/.nj) '&' (Ma/.nj) by A74,Def5;
              hence L.j = R.j by A76,A78;
            end;
            suppose
A79:          i = nj;
              dom Ma = Seg n by Lm1;
              then
A80:          Ma/.nj = Ma.i by A74,A79,PARTFUN1:def 6
                .= 0 by A18,A51,A57,A70,A74,A79;
              R.j = (bsi/.nj) '&' (Ma/.nj) by A74,Def5
                .= 0 by A80;
              hence L.j = R.j by A76;
            end;
          end;
          (f|A).a = f.a by A68,FUNCT_1:49
            .= Absval (bs0 '&' (M.a
             qua Element of n-tuples_on BOOLEAN)) by A53;
          hence (f|A).x = g.x by A69,A71,FUNCT_1:2;
        end;
        then
A81:    f|A = g|A by FUNCT_1:46;
        set bs0 = n-BinarySequence 0, bsi = n-BinarySequence 2 to_power k;
A82:    bs0 = 0*n by BINARI_3:25
          .= n |-> 0 by EUCLID:def 4;
        dom bs0 = Seg n by Lm1;
        then
A83:    bs0/.i = bs0.i by A21,A56,PARTFUN1:def 6
          .= 0 by A82;
        dom bsi = Seg n by Lm1;
        then
A84:    bsi/.i = bsi.i by A21,A56,PARTFUN1:def 6
          .= 1 by A58,A66,Th7;
A85:    (bsi '&' (Mbx)).i = (bsi/.i) '&' (Mbx/.i) by A21,A56,Def5
          .= bsi/.i by A62;
A86:    (bs0 '&' (Mbx)).i = (bs0/.i) '&' (Mbx/.i) by A21,A56,Def5
          .= bs0/.i by A62;
        g in R by A63;
        then
A87:    f|B = g|B by A49,A61,A81;
        Absval (bs0 '&' (M.bx
         qua Element of n-tuples_on BOOLEAN)) = f.bx by A53
          .= (f|B).bx by A59,FUNCT_1:49
          .= g.bx by A59,A87,FUNCT_1:49
          .= Absval (bsi '&' (M.bx
           qua Element of n-tuples_on BOOLEAN)) by A63;
        hence contradiction by A83,A86,A85,A84,BINARI_3:2;
      end;
      hence x in F by A1,A48;
    end;
    hence thesis by TARSKI:2;
  end;
end;
