
theorem :: Lemma 4.52
  for R being non empty RelStr st R is quasi_ordered holds R is Dickson iff
  for S being non empty RelStr
  st S is quasi_ordered & the InternalRel of R c= the InternalRel of S &
  the carrier of R = the carrier of S holds S\~ is well_founded
proof
  let R be non empty RelStr such that
A1: R is quasi_ordered;
A2: R is reflexive by A1;
A3: R is transitive by A1;
  set IR = the InternalRel of R, CR = the carrier of R;
  thus R is Dickson implies for S being non empty RelStr st
  S is quasi_ordered & IR c= the InternalRel of S & CR = the carrier of S
  holds S\~ is well_founded by Th47;
  assume
A4: for S being non empty RelStr st S is quasi_ordered &
  IR c= the InternalRel of S & CR = the carrier of S
  holds S\~ is well_founded;
  now
    assume not R is Dickson;
    then not (for N being non empty Subset of R
    holds min-classes N is finite & min-classes N is non empty) by A1,Th31;
    then consider f being sequence of R such that
A5: for i,j being Nat st i < j holds not f.i <= f.j by A1,Th30;
    defpred P[object,object] means
    [$1,$2] in IR or ex i,j being Element of NAT st i < j &
    [$1, f.j] in IR & [f.i, $2] in IR;
    consider QOE being Relation of CR,CR such that
A6: for x,y being object holds [x,y] in QOE iff x in CR & y in CR & P[x,y]
    from RELSET_1:sch 1;
    set S = RelStr(# CR, QOE #);
    now
      let x,y be object such that
A7:   [x,y] in IR;
A8:   x in dom IR by A7,XTUPLE_0:def 12;
      y in rng IR by A7,XTUPLE_0:def 13;
      hence [x,y] in QOE by A6,A7,A8;
    end;
    then
A9: IR c= the InternalRel of S by RELAT_1:def 3;
A10: IR is_reflexive_in CR by A2;
    then for x being object st x in CR holds [x,x] in QOE by A6;
    then QOE is_reflexive_in CR;
    then
A11: S is reflexive;
A12: IR is_transitive_in CR by A3;
    now
      let x,y,z be object such that
A13:  x in CR and
A14:  y in CR and
A15:  z in CR and
A16:  [x,y] in QOE and
A17:  [y,z] in QOE;
      now per cases by A6,A16;
        suppose
A18:      [x,y] in IR;
          now per cases by A6,A17;
            suppose [y,z] in IR;
              then [x,z] in IR by A12,A13,A14,A15,A18;
              hence [x,z] in QOE by A6,A13,A15;
            end;
            suppose ex i,j being Element of NAT
              st i<j & [y,f.j] in IR & [f.i, z] in IR;
              then consider i,j being Element of NAT such that
A19:          i < j and
A20:          [y,f.j] in IR and
A21:          [f.i, z] in IR;
              [x,f.j] in IR by A12,A13,A14,A18,A20;
              hence [x,z] in QOE by A6,A13,A15,A19,A21;
            end;
          end;
          hence [x,z] in QOE;
        end;
        suppose ex i,j being Element of NAT
          st i < j & [x, f.j] in IR & [f.i, y] in IR;
          then consider i, j being Element of NAT such that
A22:      i < j and
A23:      [x, f.j] in IR and
A24:      [f.i, y] in IR;
          now per cases by A6,A17;
            suppose [y,z] in IR;
              then [f.i, z] in IR by A12,A14,A15,A24;
              hence [x,z] in QOE by A6,A13,A15,A22,A23;
            end;
            suppose ex a,b being Element of NAT
              st a<b & [y,f.b] in IR & [f.a,z] in IR;
              then consider a,b being Element of NAT such that
A25:          a < b and
A26:          [y,f.b] in IR and
A27:          [f.a, z] in IR;
              [f.i, f.b] in IR by A12,A14,A24,A26;
              then f.i <= f.b;
              then not i < b by A5;
              then a <= i by A25,XXREAL_0:2;
              then a < j by A22,XXREAL_0:2;
              hence [x,z] in QOE by A6,A13,A15,A23,A27;
            end;
          end;
          hence [x,z] in QOE;
        end;
      end;
      hence [x,z] in QOE;
    end;
    then QOE is_transitive_in CR;
    then S is transitive;
    then S is quasi_ordered by A11;
    then
A28: S\~ is well_founded by A4,A9;
    reconsider f9=f as sequence of S\~;
    now
      let n be Nat;
      reconsider n1=n as Element of NAT by ORDINAL1:def 12;
A29:  n < n+1 by NAT_1:13;
      then not f.n1 <= f.(n1+1) by A5;
      then
A30:  not [f.n, f.(n+1)] in IR;
      hence f9.(n+1) <> f9.n by A10;
A31:  [f9.(n+1), f9.(n+1)] in IR by A10;
A32:  [f9.n, f9.n] in IR by A10;
A33:  now
        assume [f9.n, f9.(n+1)] in QOE;
        then ex i,j being Element of NAT st i < j &
        [f9.n, f.j] in IR & [f.i, f9.(n+1)] in IR by A6,A30;
        then consider l,k being Element of NAT such that
A34:    k < l and
A35:    [f9.n, f.l] in IR and
A36:    [f.k, f9.(n+1)] in IR;
A37:    f.n <= f.l by A35;
A38:    f.k <= f.(n+1) by A36;
A39:    l <= n1 by A5,A37;
A40:    n+1 <= k by A5,A38;
        l < n+1 by A39,NAT_1:13;
        hence contradiction by A34,A40,XXREAL_0:2;
      end;
A41:  [f9.(n1+1),f9.n1] in QOE by A6,A29,A31,A32;
      not [f9.(n+1),f9.n] in QOE~ by A33,RELAT_1:def 7;
      hence [f9.(n+1), f9.n] in the InternalRel of S\~ by A41,XBOOLE_0:def 5;
    end;
    then f9 is descending by WELLFND1:def 6;
    hence contradiction by A28,WELLFND1:14;
  end;
  hence thesis;
end;
