
theorem Th22: :: Lemma 4.37
  for R being non empty RelStr st R is quasi_ordered
  holds R is connected & R\~ is well_founded iff
  for N being non empty Subset of R holds card min-classes N = 1
proof
  let R be non empty RelStr such that
A1: R is quasi_ordered;
  set IR = the InternalRel of R, CR = the carrier of R;
  set IR9 = the InternalRel of R\~;
  hereby
    assume that
A2: R is connected and
A3: R\~ is well_founded;
    let N be non empty Subset of CR;
    consider x being object such that
A4: x in min-classes N by A3,Th19;
    consider a being Element of R\~ such that
A5: a is_minimal_wrt N, the InternalRel of (R\~) and
A6: x = Class(EqRel R, a) /\ N by A4,Def8;
A7: a in N by A5,WAYBEL_4:def 25;
    now
      let y be object;
      hereby
        assume y in min-classes N;
        then consider b being Element of R\~ such that
A8:     b is_minimal_wrt N, IR9 and
A9:     y = Class(EqRel R, b) /\ N by Def8;
A10:    b in N by A8,WAYBEL_4:def 25;
        reconsider a9=a as Element of R;
        reconsider b9=b as Element of R;
A11:    now per cases by A2,WAYBEL_0:def 29;
          suppose
A12:        a9 <= b9;
            then
A13:        [a, b] in IR;
            now per cases;
              suppose a = b;
                hence [b,a] in IR by A12;
              end;
              suppose
A14:            a <> b;
                now
                  assume not [b,a] in IR;
                  then not [a,b] in IR~ by RELAT_1:def 7;
                  then [a,b] in IR \ IR~ by A13,XBOOLE_0:def 5;
                  hence contradiction by A7,A8,A14,WAYBEL_4:def 25;
                end;
                hence [b,a] in IR;
              end;
            end;
            hence [a,b] in IR & [b,a] in IR by A12;
          end;
          suppose
A15:        b9 <= a9;
            then
A16:        [b, a] in IR;
            now per cases;
              suppose a = b;
                hence [a,b] in IR by A15;
              end;
              suppose
A17:            a <> b;
                now
                  assume not [a,b] in IR;
                  then not [b,a] in IR~ by RELAT_1:def 7;
                  then [b,a] in IR \ IR~ by A16,XBOOLE_0:def 5;
                  hence contradiction by A5,A10,A17,WAYBEL_4:def 25;
                end;
                hence [a,b] in IR;
              end;
            end;
            hence [a,b] in IR & [b,a] in IR by A15;
          end;
        end;
        then [b,a] in IR~ by RELAT_1:def 7;
        then [b,a] in IR /\ IR~ by A11,XBOOLE_0:def 4;
        then [b,a] in EqRel R by A1,Def4;
        then b in Class(EqRel R, a) by EQREL_1:19;
        then Class(EqRel R, b) = Class(EqRel R, a) by EQREL_1:23;
        hence y in {x} by A6,A9,TARSKI:def 1;
      end;
      assume y in {x};
      then y = Class(EqRel R, a) /\ N by A6,TARSKI:def 1;
      hence y in min-classes N by A5,Def8;
    end;
    then min-classes N = {x} by TARSKI:2;
    hence card min-classes N = 1 by CARD_1:30;
  end;
  assume
A18: for N being non empty Subset of R holds card min-classes N = 1;
  now
    let a,b be Element of R;
    assume that
A19: not a <= b and
A20: not a >= b;
A21: not [a,b] in IR by A19;
    then
A22: not [b,a] in IR~ by RELAT_1:def 7;
    not [b,a] in IR by A20;
    then
A23: not [a,b] in IR~ by RELAT_1:def 7;
    set N9 = {a,b};
    set MCN = {{a},{b}};
    now
      let x be object;
      reconsider xx =x as set by TARSKI:1;
      hereby
        assume x in min-classes N9;
        then consider y being Element of R\~ such that
A24:    y is_minimal_wrt N9, IR9 and
A25:    x = Class(EqRel R, y) /\ N9 by Def8;
A26:    y in N9 by A24,WAYBEL_4:def 25;
        per cases by A26,TARSKI:def 2;
        suppose
A27:      y = a;
          now
            let z be object;
            hereby
              assume
A28:          z in xx;
              then
A29:          z in Class(EqRel R,a) by A25,A27,XBOOLE_0:def 4;
A30:          z in N9 by A25,A28,XBOOLE_0:def 4;
              now per cases by A30,TARSKI:def 2;
                suppose z = a;
                  hence z in {a} by TARSKI:def 1;
                end;
                suppose z = b;
                  then [b,a] in EqRel R by A29,EQREL_1:19;
                  then [b,a] in IR /\ IR~ by A1,Def4;
                  hence z in {a} by A22,XBOOLE_0:def 4;
                end;
              end;
              hence z in {a};
            end;
            assume z in {a};
            then
A31:        z = a by TARSKI:def 1;
            then
A32:        z in N9 by TARSKI:def 2;
            z in Class(EqRel R, a) by A31,EQREL_1:20;
            hence z in xx by A25,A27,A32,XBOOLE_0:def 4;
          end;
          then x = {a} by TARSKI:2;
          hence x in MCN by TARSKI:def 2;
        end;
        suppose
A33:      y = b;
          now
            let z be object;
            hereby
              assume
A34:          z in xx;
              then
A35:          z in Class(EqRel R,b) by A25,A33,XBOOLE_0:def 4;
A36:          z in N9 by A25,A34,XBOOLE_0:def 4;
              now per cases by A36,TARSKI:def 2;
                suppose z = b;
                  hence z in {b} by TARSKI:def 1;
                end;
                suppose z = a;
                  then [a,b] in EqRel R by A35,EQREL_1:19;
                  then [a,b] in IR /\ IR~ by A1,Def4;
                  hence z in {b} by A21,XBOOLE_0:def 4;
                end;
              end;
              hence z in {b};
            end;
            assume z in {b};
            then
A37:        z = b by TARSKI:def 1;
            then
A38:        z in N9 by TARSKI:def 2;
            z in Class(EqRel R, b) by A37,EQREL_1:20;
            hence z in xx by A25,A33,A38,XBOOLE_0:def 4;
          end;
          then x = {b} by TARSKI:2;
          hence x in MCN by TARSKI:def 2;
        end;
      end;
      assume
A39:  x in MCN;
      per cases by A39,TARSKI:def 2;
      suppose
A40:    x = {a};
        now reconsider a9=a as Element of R\~;
          take a9;
A41:      a9 in N9 by TARSKI:def 2;
          now
            assume ex y being set st y in N9 & y <> a9 & [y,a9] in IR9;
            then consider y being set such that
A42:        y in N9 and
A43:        y <> a9 and
A44:        [y,a9] in IR9;
            y = b by A42,A43,TARSKI:def 2;
            hence contradiction by A20,A44;
          end;
          hence a9 is_minimal_wrt N9, the InternalRel of (R\~)
          by A41,WAYBEL_4:def 25;
          now
            let z be object;
            hereby
              assume z in xx;
              then
A45:          z = a by A40,TARSKI:def 1;
              then z in Class(EqRel R, a) by EQREL_1:20;
              hence z in Class(EqRel R, a) /\ N9 by A41,A45,XBOOLE_0:def 4;
            end;
            assume
A46:        z in Class(EqRel R, a) /\ N9;
            then
A47:        z in Class(EqRel R, a) by XBOOLE_0:def 4;
A48:        z in N9 by A46,XBOOLE_0:def 4;
            per cases by A48,TARSKI:def 2;
            suppose z = a;
              hence z in xx by A40,TARSKI:def 1;
            end;
            suppose z = b;
              then [b,a] in EqRel R by A47,EQREL_1:19;
              then [b,a] in IR /\ IR~ by A1,Def4;
              hence z in xx by A22,XBOOLE_0:def 4;
            end;
          end;
          hence x = Class(EqRel R, a9) /\ N9 by TARSKI:2;
        end;
        hence x in min-classes N9 by Def8;
      end;
      suppose
A49:    x = {b};
        now reconsider b9=b as Element of R\~;
          take b9;
A50:      b9 in N9 by TARSKI:def 2;
          now
            assume ex y being set st y in N9 & y <> b9 & [y,b9] in IR9;
            then consider y being set such that
A51:        y in N9 and
A52:        y <> b9 and
A53:        [y,b9] in IR9;
            y = a by A51,A52,TARSKI:def 2;
            hence contradiction by A19,A53;
          end;
          hence b9 is_minimal_wrt N9, the InternalRel of (R\~)
          by A50,WAYBEL_4:def 25;
          now
            let z be object;
            hereby
              assume z in xx;
              then
A54:          z = b by A49,TARSKI:def 1;
              then z in Class(EqRel R, b) by EQREL_1:20;
              hence z in Class(EqRel R, b) /\ N9 by A50,A54,XBOOLE_0:def 4;
            end;
            assume
A55:        z in Class(EqRel R, b) /\ N9;
            then
A56:        z in Class(EqRel R, b) by XBOOLE_0:def 4;
A57:        z in N9 by A55,XBOOLE_0:def 4;
            per cases by A57,TARSKI:def 2;
            suppose z = b;
              hence z in xx by A49,TARSKI:def 1;
            end;
            suppose z = a;
              then [a,b] in EqRel R by A56,EQREL_1:19;
              then [a,b] in IR /\ IR~ by A1,Def4;
              hence z in xx by A23,XBOOLE_0:def 4;
            end;
          end;
          hence x = Class(EqRel R, b9) /\ N9 by TARSKI:2;
        end;
        hence x in min-classes N9 by Def8;
      end;
    end;
    then min-classes N9 = MCN by TARSKI:2;
    then
A58: card MCN = 1 by A18;
    now
      assume {a} = {b};
      then
A59:  a = b by ZFMISC_1:3;
      R is reflexive by A1;
      then IR is_reflexive_in CR;
      hence contradiction by A21,A59;
    end;
    hence contradiction by A58,CARD_2:57;
  end;
  hence R is connected by WAYBEL_0:def 29;
  now
    let N be Subset of R;
    assume N <> {};
    then card min-classes N = 1 by A18;
    then min-classes N <> {};
    hence ex x being object st x in min-classes N by XBOOLE_0:def 1;
  end;
  hence thesis by Th19;
end;
