
theorem Th6:
  for R being antisymmetric transitive non empty RelStr,
  X being finite Subset of R st X <> {} holds
  ex x being Element of R st x in X & x is_minimal_wrt X, the InternalRel of R
proof
  let R be antisymmetric transitive non empty RelStr, X be finite Subset of R;
  set IR = the InternalRel of R, CR = the carrier of R;
A1: IR is_transitive_in CR by ORDERS_2:def 3;
A2: IR is_antisymmetric_in CR by ORDERS_2:def 4;
A3: X is finite;
  defpred P[set] means (($1 <> {}) implies (ex x being Element of R
  st x in $1 & x is_minimal_wrt $1, IR));
A4: P[{}];
  now
    let y,B be set such that
A5: y in X and B c= X and
A6: B <> {} implies ex x being Element of R st x in B & x is_minimal_wrt B, IR;
    reconsider y9=y as Element of R by A5;
    assume (B \/ {y}) <> {};
    per cases;
    suppose
A7:   B = {};
      take y9;
      thus y9 in B \/ {y} by A7,TARSKI:def 1;
A8:   y9 in (B \/ {y}) by A7,TARSKI:def 1;
      not ex z being set st z in (B \/ {y9}) & z <> y9 & [z,y9] in IR by A7,
TARSKI:def 1;
      hence y9 is_minimal_wrt (B \/ {y}), IR by A8,WAYBEL_4:def 25;
    end;
    suppose B <> {};
      then consider x being Element of R such that
A9:   x in B and
A10:  x is_minimal_wrt B, IR by A6;
      now per cases;
        suppose
A11:      [y,x] in IR;
          take y9;
A12:      y in {y} by TARSKI:def 1;
          hence y9 in B \/ {y} by XBOOLE_0:def 3;
A13:      now
            assume ex z being set st z in (B \/ {y}) & z <> y & [z,y] in IR;
            then consider z being set such that
A14:        z in (B \/ {y}) and
A15:        z <> y and
A16:        [z,y] in IR;
A17:        y9 in CR;
            z in CR by A16,ZFMISC_1:87;
            then
A18:        [z,x] in IR by A1,A11,A16,A17;
            per cases by A14,XBOOLE_0:def 3;
            suppose
A19:          z in B;
              now per cases;
                suppose
A20:              z = x;
                  then x = y9 by A2,A11,A16;
                  hence contradiction by A15,A20;
                end;
                suppose z <> x;
                  hence contradiction by A10,A18,A19,WAYBEL_4:def 25;
                end;
              end;
              hence contradiction;
            end;
            suppose z in {y};
              hence contradiction by A15,TARSKI:def 1;
            end;
          end;
          y9 in B \/ {y} by A12,XBOOLE_0:def 3;
          hence y9 is_minimal_wrt (B \/ {y}), IR by A13,WAYBEL_4:def 25;
        end;
        suppose
A21:      [x,y] in IR;
          take x;
          thus x in (B \/ {y}) by A9,XBOOLE_0:def 3;
A22:      now
            assume ex z being set st z in B \/ {y} & z <> x & [z,x] in IR;
            then consider z being set such that
A23:        z in B \/ {y} and
A24:        z <> x and
A25:        [z,x] in IR;
            per cases by A23,XBOOLE_0:def 3;
            suppose z in B;
              hence contradiction by A10,A24,A25,WAYBEL_4:def 25;
            end;
            suppose z in {y};
              then
A26:          z = y by TARSKI:def 1;
              z in CR by A25,ZFMISC_1:87;
              hence contradiction by A2,A21,A24,A25,A26;
            end;
          end;
          x in (B \/ {y}) by A9,XBOOLE_0:def 3;
          hence x is_minimal_wrt (B \/ {y}), IR by A22,WAYBEL_4:def 25;
        end;
        suppose
A27:      not [x,y] in IR & not [y,x] in IR;
          take x;
          thus x in (B \/ {y}) by A9,XBOOLE_0:def 3;
A28:      now
            assume ex z being set st z in B \/ {y} & z <> x & [z,x] in IR;
            then consider z being set such that
A29:        z in B \/ {y} and
A30:        z <> x and
A31:        [z,x] in IR;
            per cases by A29,XBOOLE_0:def 3;
            suppose z in B;
              hence contradiction by A10,A30,A31,WAYBEL_4:def 25;
            end;
            suppose z in {y};
              hence contradiction by A27,A31,TARSKI:def 1;
            end;
          end;
          x in (B \/ {y}) by A9,XBOOLE_0:def 3;
          hence x is_minimal_wrt (B \/ {y}), IR by A28,WAYBEL_4:def 25;
        end;
      end;
      hence ex x being Element of R
      st x in (B \/ {y}) & x is_minimal_wrt (B \/ {y}), IR;
    end;
  end;
  then
A32: for y,B being set st y in X & B c= X & P[B] holds P[B \/ {y}];
  thus P[X] from FINSET_1:sch 2(A3, A4, A32);
end;
