reserve A for non empty closed_interval Subset of REAL;

theorem
for a,b,c,d be Real, f,F be Function of REAL,REAL st
b > 0 & c > 0 & d > 0 &
( for x be Real holds f.x = max(0, b - |. b*(x-a)/c .|)) &
( for x be Real holds F.x = min(d, max(0, b - |. b*(x-a)/c .|))) holds
centroid (f,['a-c,a+c']) = centroid (F,['a-c,a+c'])
proof
 let a,b,c,d be Real, f,F be Function of REAL,REAL;
 assume A1: b > 0 & c > 0 & d > 0;
 assume A2:for x be Real holds f.x = max(0, b - |. b*(x-a)/c .|);
 assume A3:for x be Real holds F.x = min(d, max(0, b - |. b*(x-a)/c .|));
 per cases;
 suppose d < b; then
  centroid (F,['a-c,a+c']) = a by Lm221,A1,A3;
  hence thesis by FUZZY_7:31,A1,A2;
 end;
 suppose A5: d >= b;
  A4:dom f = REAL by FUNCT_2:def 1
  .= dom F by FUNCT_2:def 1;
  for x being object st x in dom f holds f . x = F . x
  proof
   let x be object;
   assume Xac: x in dom f;
   reconsider x as Real by Xac;
   A6: d >= max(0, b - |. b*(x-a)/c .|)
   proof
    per cases by XXREAL_0:16;
    suppose max(0, b - |. b*(x-a)/c .|) = 0;
     hence thesis by A1;
    end;
    suppose B2: max(0, b - |. b*(x-a)/c .|) = b - |. b*(x-a)/c .|;
     b - |. b*(x-a)/c .| <= b by L724x;
     hence thesis by A5,XXREAL_0:2,B2;
    end;
   end;
   F.x = min(d, max(0, b - |. b*(x-a)/c .|)) by A3
   .= max(0, b - |. b*(x-a)/c .|) by XXREAL_0:def 9,A6
   .= f.x by A2;
   hence thesis;
  end;
  hence thesis by FUNCT_1:2,A4;
 end;
end;
