reserve a,b,c for set;

theorem Th19:
  for U being Subset of REAL holds {x where x is Element of REAL:
  x is_local_minimum_of U} is countable
proof
  let U be Subset of REAL;
  set X = {x where x is Element of REAL: x is_local_minimum_of U};
  defpred P[object,object] means
ex x,y being Real st $1 = x & $2 = ].y,x.[ &
  y < x & ].y,x.[ misses U;
A1: now
    let a be object;
    assume a in X;
    then consider x being Element of REAL such that
A2: a = x and
A3: x is_local_minimum_of U;
    ex y being Real st y < x & ].y,x.[ misses U by A3;
    hence ex b being object st b in bool REAL & P[a,b] by A2;
  end;
  consider f being Function such that
A4: dom f = X & rng f c= bool REAL and
A5: for a being object st a in X holds P[a,f.a] from FUNCT_1:sch 6(A1);
  f is one-to-one
  proof
    let a9,b9 being object;
    set a = f.a9, b = f.b9;
    assume that
A6: a9 in dom f and
A7: b9 in dom f;
    consider xb,yb being Real such that
A8: b9 = xb and
A9: b = ].yb,xb.[ and
    yb < xb and
A10: ].yb,xb.[ misses U by A4,A5,A7;
    ex x being Element of REAL st xb = x & x is_local_minimum_of U by A4,A7,A8;
    then
A11: xb in U;
    assume that
A12: a = b and
A13: a9 <> b9;
    consider xa,ya being Real such that
A14: a9 = xa and
A15: a = ].ya,xa.[ and
A16: ya < xa and
A17: ].ya,xa.[ misses U by A4,A5,A6;
    consider c being Rational such that
A18: ya < c and
A19: c < xa by A16,RAT_1:7;
A20: c in a by A15,A18,A19,XXREAL_1:4;
    then
A21: c < xb by A9,A12,XXREAL_1:4;
    ex x being Element of REAL st xa = x & x is_local_minimum_of U by A4,A6,A14
;
    then
A22: xa in U;
    yb < c by A9,A12,A20,XXREAL_1:4;
    then yb < xa & xa < xb or xa > xb & xb > ya by A19,A18,A21,A14,A8,A13,
XXREAL_0:1,2;
    then xa in b or xb in a by A15,A9,XXREAL_1:4;
    hence thesis by A15,A17,A9,A10,A11,A22,XBOOLE_0:3;
  end;
  then
A23: card X c= card rng f by A4,CARD_1:10;
A24: rng f is mutually-disjoint
  proof
    let a,b;
    assume a in rng f;
    then consider a9 being object such that
A25: a9 in dom f and
A26: a = f.a9 by FUNCT_1:def 3;
    consider xa,ya being Real such that
A27: a9 = xa and
A28: a = ].ya,xa.[ and
    ya < xa and
A29: ].ya,xa.[ misses U by A4,A5,A25,A26;
    ex x being Element of REAL st xa = x & x is_local_minimum_of U by A4,A25
,A27;
    then
A30: xa in U;
    assume b in rng f;
    then consider b9 being object such that
A31: b9 in dom f and
A32: b = f.b9 by FUNCT_1:def 3;
    consider xb,yb being Real such that
A33: b9 = xb and
A34: b = ].yb,xb.[ and
    yb < xb and
A35: ].yb,xb.[ misses U by A4,A5,A31,A32;
    assume that
A36: a <> b and
A37: a meets b;
    consider c being object such that
A38: c in a and
A39: c in b by A37,XBOOLE_0:3;
    reconsider c as Element of REAL by A28,A38;
A40: c < xa by A28,A38,XXREAL_1:4;
    ex x being Element of REAL st xb = x & x is_local_minimum_of U by A4,A31
,A33;
    then
A41: xb in U;
A42: c < xb by A34,A39,XXREAL_1:4;
A43: ya < c by A28,A38,XXREAL_1:4;
    yb < c by A34,A39,XXREAL_1:4;
    then yb < xa & xa < xb or xa > xb & xb > ya by A40,A43,A42,A26,A32,A27,A33
,A36,XXREAL_0:1,2;
    then xa in b or xb in a by A28,A34,XXREAL_1:4;
    hence thesis by A28,A29,A34,A35,A41,A30,XBOOLE_0:3;
  end;
  now
    let a;
    assume a in rng f;
    then consider b being object such that
A44: b in dom f and
A45: a = f.b by FUNCT_1:def 3;
    consider x,y being Real such that
    b = x and
A46: a = ].y,x.[ and
A47: y < x and
    ].y,x.[ misses U by A4,A5,A44,A45;
    take y,x;
    thus y < x & ].y,x.[ c= a by A46,A47;
  end;
  then rng f is countable by A24,Th18;
  then card rng f c= omega;
  hence card X c= omega by A23;
end;
