reserve A for RelStr;
reserve X for non empty set;
reserve PX,PY,PZ,Y,a,b,c,x,y for set;
reserve S1,S2 for Subset of Y;

theorem
  for H being covering T_3 Hierarchy of X st H is lower-bounded & not {}
in H & (for C1 be set st (C1 <> {} & C1 c= PARTITIONS(X) & (for P1,P2 be set st
P1 in C1 & P2 in C1 holds P1 is_finer_than P2 or P2 is_finer_than P1)) holds (
ex PX,PY st (PX in C1 & PY in C1 & for PZ st PZ in C1 holds PZ is_finer_than PY
  & PX is_finer_than PZ))) ex C being Classification of X st union C = H
proof
  let H be covering T_3 Hierarchy of X such that
A1: H is lower-bounded and
A2: not {} in H and
A3: for C1 be set st C1 <> {} & C1 c= PARTITIONS(X) & (for P1,P2 be set
st P1 in C1 & P2 in C1 holds P1 is_finer_than P2 or P2 is_finer_than P1) holds
ex PX,PY st (PX in C1 & PY in C1 & for PZ st PZ in C1 holds PZ is_finer_than PY
  & PX is_finer_than PZ);
  union H = X by ABIAN:4;
  then consider h be object such that
A4: h in H by XBOOLE_0:def 1,ZFMISC_1:2;
  reconsider h as Subset of X by A4;
  consider PX being a_partition of X such that
  h in PX and
A5: PX c= H by A1,A2,A4,Th16;
  set L = {PX};
A6: L c= PARTITIONS(X)
  proof
    let l be object;
    assume l in L;
    then l = PX by TARSKI:def 1;
    hence thesis by PARTIT1:def 3;
  end;
A7: now
    let P1,P2 be set;
    assume that
A8: P1 in L and
A9: P2 in L;
    P1 = PX by A8,TARSKI:def 1;
    hence P1 is_finer_than P2 or P2 is_finer_than P1 by A9,TARSKI:def 1;
  end;
A10: H is hierarchic by Def4;
  defpred X[set] means (for P be set holds P in $1 implies P c= H) & (for P1,
  P2 be set holds P1 in $1 & P2 in $1 implies P1 is_finer_than P2 or P2
  is_finer_than P1);
  consider RL be set such that
A11: for L be set holds L in RL iff L in bool PARTITIONS X & X[L] from
  XFAMILY:sch 1;
  for a st a in L holds a c= H by A5,TARSKI:def 1;
  then
A12: L in RL by A11,A6,A7;
  now
    let Z be set such that
A13: Z c= RL and
A14: Z is c=-linear;
    set Y = union Z;
A15: for X1,X2 being set st X1 in Z & X2 in Z holds X1 c= X2 or X2 c= X1
      by XBOOLE_0:def 9,A14,ORDINAL1:def 8;
A16: now
      let P1,P2 be set;
      assume that
A17:  P1 in Y and
A18:  P2 in Y;
      consider L1 be set such that
A19:  P1 in L1 and
A20:  L1 in Z by A17,TARSKI:def 4;
      consider L2 be set such that
A21:  P2 in L2 and
A22:  L2 in Z by A18,TARSKI:def 4;
      per cases by A15,A20,A22;
      suppose
        L1 c= L2;
        hence P1 is_finer_than P2 or P2 is_finer_than P1 by A11,A13,A19,A21,A22
;
      end;
      suppose
        L2 c= L1;
        hence P1 is_finer_than P2 or P2 is_finer_than P1 by A11,A13,A19,A20,A21
;
      end;
    end;
    take Y;
A23: now
      let P be set;
      assume P in Y;
      then ex L3 be set st P in L3 & L3 in Z by TARSKI:def 4;
      hence P c= H by A11,A13;
    end;
    Y c= PARTITIONS(X)
    proof
      let P be object;
      assume P in Y;
      then consider L4 be set such that
A24:  P in L4 and
A25:  L4 in Z by TARSKI:def 4;
      L4 in bool PARTITIONS(X) by A11,A13,A25;
      hence thesis by A24;
    end;
    hence Y in RL by A11,A23,A16;
    thus for X1 be set st X1 in Z holds X1 c= Y by ZFMISC_1:74;
  end;
  then consider C be set such that
A26: C in RL and
A27: for Z be set st Z in RL & Z <> C holds not C c= Z by A12,ORDERS_1:65;
  reconsider C as Subset of PARTITIONS(X) by A11,A26;
A28: C is Classification of X
  proof
    let P1,P2 be a_partition of X such that
A29: P1 in C and
A30: P2 in C;
    thus thesis by A11,A26,A29,A30;
  end;
A31: C <> {} by A12,A27,XBOOLE_1:2;
A32: H c= union C
  proof
    let h be object such that
A33: h in H;
    reconsider hh=h as set by TARSKI:1;
    per cases;
    suppose
A34:  not h in union C;
      defpred X[set] means
        ex hx be set st (hx in $1 & hh c= hx & h <> hx);
      consider Ca be set such that
A35:  for p be set holds p in Ca iff p in C & X[p] from XFAMILY:sch
      1;
A36:  Ca c= C
      by A35;
      defpred X[set] means ex hx be set st (hx in $1 & hx c= hh & h <> hx);
      consider Cb be set such that
A37:  for p be set holds p in Cb iff p in C & X[p] from XFAMILY:sch
      1;
      consider PS be a_partition of X such that
A38:  h in PS and
A39:  PS c= H by A1,A2,A33,Th16;
A40:  h <> {} by A38,EQREL_1:def 4;
A41:  now
        consider t be object such that
A42:    t in hh by A40,XBOOLE_0:def 1;
        let p be set;
        assume p in C;
        then p is a_partition of X by PARTIT1:def 3;
        then union p = X by EQREL_1:def 4;
        then consider v be set such that
A43:    t in v and
A44:    v in p by A33,A42,TARSKI:def 4;
        assume
A45:    for hv be set st hv in p holds hv misses hh;
        not v misses hh by A42,A43,XBOOLE_0:3;
        hence contradiction by A45,A44;
      end;
A46:  C c= Ca \/ Cb
      proof
        let p be object such that
A47:    p in C;
        reconsider pp=p as set by TARSKI:1;
        consider hv be set such that
A48:    hv in pp and
A49:    not hv misses hh by A41,A47;
A50:    h <> hv by A34,A47,A48,TARSKI:def 4;
A51:    pp c= H by A11,A26,A47;
        per cases by A10,A33,A48,A49,A51;
        suppose
          hv c= hh;
          then p in Cb by A37,A47,A48,A50;
          hence thesis by XBOOLE_0:def 3;
        end;
        suppose
          hh c= hv;
          then p in Ca by A35,A47,A48,A50;
          hence thesis by XBOOLE_0:def 3;
        end;
      end;
      Cb c= C
      by A37;
      then Ca \/ Cb c= C by A36,XBOOLE_1:8;
      then
A52:  C = Ca \/ Cb by A46,XBOOLE_0:def 10;
      then
A53:  Ca c= C by XBOOLE_1:7;
A54:  now
        let P1,P2 be set such that
A55:    P1 in Ca and
A56:    P2 in Ca;
        P2 in C by A53,A56;
        then
A57:    P2 is a_partition of X by PARTIT1:def 3;
        P1 in C by A53,A55;
        then P1 is a_partition of X by PARTIT1:def 3;
        hence P1 is_finer_than P2 or P2 is_finer_than P1 by A28,A53,A55,A56,A57
,TAXONOM1:def 1;
      end;
A58:  Cb c= C by A52,XBOOLE_1:7;
A59:  now
        let P1,P2 be set such that
A60:    P1 in Cb and
A61:    P2 in Cb;
        P2 in C by A58,A61;
        then
A62:    P2 is a_partition of X by PARTIT1:def 3;
        P1 in C by A58,A60;
        then P1 is a_partition of X by PARTIT1:def 3;
        hence P1 is_finer_than P2 or P2 is_finer_than P1 by A28,A58,A60,A61,A62
,TAXONOM1:def 1;
      end;
      now
        per cases;
        suppose
A63:      Cb <> {};
          defpred X[set] means $1 misses hh;
A64:      {h} c= H
          by A33,TARSKI:def 1;
          consider PX,Pmax be set such that
          PX in Cb and
A65:      Pmax in Cb and
A66:      for PZ st PZ in Cb holds PZ is_finer_than Pmax & PX
          is_finer_than PZ by A3,A58,A59,A63,XBOOLE_1:1;
          consider Pb be set such that
A67:      for x holds x in Pb iff x in Pmax & X[x] from XFAMILY:sch
          1;
          set PS1 = Pb \/ {h};
          set C1 = C \/ {PS1};
          Pmax in C by A58,A65;
          then
A68:      Pmax is a_partition of X by PARTIT1:def 3;
A69:      Pmax c= H by A11,A26,A58,A65;
          then
A70:      for a st a in Pmax holds a c= hh or hh c= a or hh misses a
              by A10,A33;
          Pb c= Pmax
          by A67;
          then Pb c= H by A69;
          then
A71:      PS1 c= H by A64,XBOOLE_1:8;
A72:      now
            let P3 be set;
            assume
A73:        P3 in C1;
            per cases by A73,XBOOLE_0:def 3;
            suppose
              P3 in C;
              hence P3 c= H by A11,A26;
            end;
            suppose
              P3 in {PS1};
              hence P3 c= H by A71,TARSKI:def 1;
            end;
          end;
          PS1 in {PS1} by TARSKI:def 1;
          then
A74:      PS1 in C1 by XBOOLE_0:def 3;
          h in {h} by TARSKI:def 1;
          then
A75:      h in PS1 by XBOOLE_0:def 3;
A76:      ex hx be set st hx in Pmax & hx c= hh & hh <> hx by A37,A65;
          then
A77:      Pmax is_finer_than PS1 by A33,A40,A68,A67,A70,Th18;
A78:      now
            let P3 be set such that
A79:        P3 in C;
            per cases;
            suppose
              Ca = {};
              then P3 is_finer_than Pmax by A46,A66,A79;
              hence PS1 is_finer_than P3 or P3 is_finer_than PS1 by A77,
SETFAM_1:17;
            end;
            suppose
A80:          Ca <> {};
              now
                per cases by A46,A79,XBOOLE_0:def 3;
                suppose
A81:              P3 in Ca;
                  consider Pmin,PY be set such that
A82:              Pmin in Ca and
                  PY in Ca and
A83:              for PZ st PZ in Ca holds PZ is_finer_than PY &
                  Pmin is_finer_than PZ by A3,A53,A54,A80,XBOOLE_1:1;
A84:              Pmin is_finer_than P3 by A81,A83;
A85:              now
                    consider hx be set such that
A86:                hx in Pmin and
A87:                hh c= hx and
A88:                h <> hx by A35,A82;
                    assume Pmin is_finer_than Pmax;
                    then consider hz be set such that
A89:                hz in Pmax and
A90:                hx c= hz by A86;
                    consider hy be set such that
A91:                hy in Pmax and
A92:                hy c= hh and
                    h <> hy by A37,A65;
A93:                hy is non empty by A68,A91,EQREL_1:def 4;
                    hy c= hx by A87,A92;
                    then hy meets hz by A90,A93,Lm5,XBOOLE_1:1;
                    then hy = hz by A68,A91,A89,EQREL_1:def 4;
                    then hx c= hh by A92,A90;
                    hence contradiction by A87,A88,XBOOLE_0:def 10;
                  end;
A94:              Pmax in C by A52,A65,XBOOLE_0:def 3;
                  then
A95:              Pmax is a_partition of X by PARTIT1:def 3;
                  Pmin in C by A53,A82;
                  then
A96:              Pmin is a_partition of X by PARTIT1:def 3;
A97:              ex hw be set st hw in Pmin & hh c= hw & h <> hw by A35,A82;
A98:             Pmin in C by A52,A82,XBOOLE_0:def 3;
                  then Pmin is a_partition of X by PARTIT1:def 3;
                  then Pmax is_finer_than Pmin by A28,A98,A94,A95,A85,
TAXONOM1:def 1;
                  then PS1 is_finer_than Pmin by A33,A40,A68,A67,A70,A76,A96
,A97,Th18;
                  hence PS1 is_finer_than P3 or P3 is_finer_than PS1 by A84,
SETFAM_1:17;
                end;
                suppose
                  P3 in Cb;
                  then P3 is_finer_than Pmax by A66;
                  hence PS1 is_finer_than P3 or P3 is_finer_than PS1 by A77,
SETFAM_1:17;
                end;
              end;
              hence PS1 is_finer_than P3 or P3 is_finer_than PS1;
            end;
          end;
A99:     now
            let P1,P2 be set;
            assume that
A100:       P1 in C1 and
A101:       P2 in C1;
            per cases by A100,XBOOLE_0:def 3;
            suppose
A102:         P1 in C;
              per cases by A101,XBOOLE_0:def 3;
              suppose
A103:           P2 in C;
                then
A104:           P2 is a_partition of X by PARTIT1:def 3;
                P1 is a_partition of X by A102,PARTIT1:def 3;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A28,A102
,A103,A104,TAXONOM1:def 1;
              end;
              suppose
                P2 in {PS1};
                then P2 = PS1 by TARSKI:def 1;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A78,A102;
              end;
            end;
            suppose
              P1 in {PS1};
              then
A105:         P1 = PS1 by TARSKI:def 1;
              per cases by A101,XBOOLE_0:def 3;
              suppose
                P2 in C;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A78,A105;
              end;
              suppose
                P2 in {PS1};
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A105,
TARSKI:def 1;
              end;
            end;
          end;
A106:     PS1 is a_partition of X by A33,A40,A68,A67,A70,A76,Th18;
          {PS1} c= PARTITIONS(X)
          proof
            let s be object;
            assume s in {PS1};
            then s = PS1 by TARSKI:def 1;
            hence thesis by A106,PARTIT1:def 3;
          end;
          then C1 c= PARTITIONS(X) by XBOOLE_1:8;
          then C1 in RL by A11,A72,A99;
          then C = C1 by A27,XBOOLE_1:7;
          hence thesis by A75,A74,TARSKI:def 4;
        end;
        suppose
A107:     Cb = {};
          then consider Pmin,PY be set such that
A108:     Pmin in Ca and
          PY in Ca and
A109:     for PZ st PZ in Ca holds PZ is_finer_than PY & Pmin
          is_finer_than PZ by A3,A31,A52,A54;
          consider hw be set such that
A110:     hw in Pmin and
A111:     hh c= hw and
          hh <> hw by A35,A108;
          defpred X[set] means $1 c= hw;
          consider PT be set such that
A112:     for a holds a in PT iff a in PS & X[a] from XFAMILY:sch 1;
          set PS1 = PT \/ (Pmin \ {hw});
          set C1 = C \/ {PS1};
          PT c= PS
          by A112;
          then
A113:     PT c= H by A39;
A114:     Pmin c= H by A11,A26,A53,A108;
          then Pmin \ {hw} c= H;
          then
A115:     PS1 c= H by A113,XBOOLE_1:8;
A116:     now
            let P3 be set;
            assume
A117:       P3 in C1;
            per cases by A117,XBOOLE_0:def 3;
            suppose
              P3 in C;
              hence P3 c= H by A11,A26;
            end;
            suppose
              P3 in {PS1};
              hence P3 c= H by A115,TARSKI:def 1;
            end;
          end;
          Pmin in C by A53,A108;
          then
A118:     Pmin is a_partition of X by PARTIT1:def 3;
A119:     for a st a in PS holds a c= hw or hw c= a or hw misses a by A10,A39
,A114,A110;
          then
A120:     PS1 is_finer_than Pmin by A38,A40,A118,A110,A111,A112,Th17;
A121:     now
            let P3 be set;
            assume P3 in C;
            then Pmin is_finer_than P3 by A46,A107,A109;
            hence PS1 is_finer_than P3 or P3 is_finer_than PS1 by A120,
SETFAM_1:17;
          end;
A122:     now
            let P1,P2 be set;
            assume that
A123:       P1 in C1 and
A124:       P2 in C1;
            per cases by A123,XBOOLE_0:def 3;
            suppose
A125:         P1 in C;
              per cases by A124,XBOOLE_0:def 3;
              suppose
A126:           P2 in C;
                then
A127:           P2 is a_partition of X by PARTIT1:def 3;
                P1 is a_partition of X by A125,PARTIT1:def 3;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A28,A125
,A126,A127,TAXONOM1:def 1;
              end;
              suppose
                P2 in {PS1};
                then P2 = PS1 by TARSKI:def 1;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A121,A125;
              end;
            end;
            suppose
              P1 in {PS1};
              then
A128:         P1 = PS1 by TARSKI:def 1;
              per cases by A124,XBOOLE_0:def 3;
              suppose
                P2 in C;
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A121,A128;
              end;
              suppose
                P2 in {PS1};
                hence P1 is_finer_than P2 or P2 is_finer_than P1 by A128,
TARSKI:def 1;
              end;
            end;
          end;
A129:     PS1 is a_partition of X by A38,A40,A118,A110,A111,A112,A119,Th17;
          {PS1} c= PARTITIONS(X)
          proof
            let s be object;
            assume s in {PS1};
            then s = PS1 by TARSKI:def 1;
            hence thesis by A129,PARTIT1:def 3;
          end;
          then C1 c= PARTITIONS(X) by XBOOLE_1:8;
          then C1 in RL by A11,A116,A122;
          then
A130:     C = C1 by A27,XBOOLE_1:7;
A131:     PT c= PS1 by XBOOLE_1:7;
A132:     PS1 in {PS1} by TARSKI:def 1;
A133:     {PS1} c= C1 by XBOOLE_1:7;
          h in PT by A38,A111,A112;
          hence thesis by A131,A133,A132,A130,TARSKI:def 4;
        end;
      end;
      hence thesis;
    end;
    suppose
      h in union C;
      hence thesis;
    end;
  end;
  take C;
  union C c= H
  proof
    let h be object;
    assume h in union C;
    then consider P be set such that
A134: h in P and
A135: P in C by TARSKI:def 4;
    P c= H by A11,A26,A135;
    hence thesis by A134;
  end;
  hence thesis by A28,A32,XBOOLE_0:def 10;
end;
