reserve A for non empty closed_interval Subset of REAL;

theorem Th17AX:
for b being Real, f,g,h be Function of REAL,REAL st
h  = (f| ].-infty,b.[) +* (g | [.b,+infty.[) & f.b = g.b holds
( b <= lower_bound A implies h | A = g | A ) &
( upper_bound A <= b implies h | A = f | A )
proof
 let b being Real, f,g,h be Function of REAL,REAL;
 assume that
 A1: h  = (f| ].-infty,b.[) +* (g | [.b,+infty.[) and
 A2: f.b = g.b;
 XX: b <= lower_bound A implies h | A = g | A
 proof
  assume A3: b <= lower_bound A;
  B3: dom (h | A) = A by FUNCT_2:def 1
  .= dom (g | A) by FUNCT_2:def 1;
  for x being object st x in dom (h | A) holds (h | A).x = (g | A).x
  proof
   let x be object;
   assume A4: x in dom (h | A); then
   reconsider x as Real;
   x in A by A4; then
   x in [.lower_bound A, upper_bound A .] by INTEGRA1:4;
   then
   lower_bound A <= x & x <= upper_bound A by XXREAL_1:1;
   then
   x in [.b,+infty.[ by XXREAL_1:236,XXREAL_0:2,A3; then
   B5: x in dom (g | [.b,+infty.[) by FUNCT_2:def 1;
   (h | A).x
    = ((f| ].-infty,b.[) +* (g | [.b,+infty.[)).x by A1,FUNCT_1:47,A4
   .= (g | [.b,+infty.[).x by B5,FUNCT_4:13
   .= g.x by FUNCT_1:47,B5;
   hence thesis by FUNCT_1:49,A4;
  end;
  hence thesis by B3,FUNCT_1:2;
 end;
 upper_bound A <= b implies h | A = f | A
 proof
  assume A3: upper_bound A <= b;
  B3: dom (h | A) = A by FUNCT_2:def 1
  .= dom (f | A) by FUNCT_2:def 1;
  for x being object st x in dom (h | A) holds (h | A).x = (f | A).x
  proof
   let x be object;
   assume A4: x in dom (h | A); then
   reconsider x as Real;
   x in A by A4; then
   x in [.lower_bound A, upper_bound A .] by INTEGRA1:4;
   then
   lower_bound A <= x & x <= upper_bound A by XXREAL_1:1;
   then
   A10: x <= b by XXREAL_0:2,A3;
per cases;
suppose C1: x = b; then
 x in [.b,+infty.[ by XXREAL_1:236;then
 C3: x in dom (g | [.b,+infty.[ ) by FUNCT_2:def 1;
  (h | A).x
   = ((f| ].-infty,b.[) +* (g | [.b,+infty.[)).x by A1,FUNCT_1:47,A4
  .= (g | [.b,+infty.[).x by FUNCT_4:13,C3
  .= f.x by C1,A2,FUNCT_1:49,XXREAL_1:236;
   hence thesis by FUNCT_1:49,A4;
end;
suppose x <> b; then
C4: x < b by A10,XXREAL_0:1; then
C5: not (x in dom (g | [.b,+infty.[)) by XXREAL_1:236;
(h | A).x
= ((f| ].-infty,b.[) +* (g | [.b,+infty.[)).x by A1,FUNCT_1:47,A4
.= (f| ].-infty,b.[).x by C5,FUNCT_4:11
.= f.x by FUNCT_1:49,C4,XXREAL_1:233;
   hence thesis by FUNCT_1:49,A4;
end;
  end;
  hence thesis by B3,FUNCT_1:2;
 end;
 hence thesis by XX;
end;
