reserve A for non empty closed_interval Subset of REAL;

theorem Th17C:
for a,b,p,q being Real, f be Function of REAL,REAL st
f = ( AffineMap (a,b) |].-infty,(q-b)/(a-p).[ )
 +* ( AffineMap (p,q) |[.(q-b)/(a-p),+infty.[ ) & (q-b)/(a-p) in A
holds
f | A = ( AffineMap (a,b) |[.lower_bound A,(q-b)/(a-p).] )
 +* ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] )
proof
 let a,b,p,q being Real, f be Function of REAL,REAL;
 assume that
 A2: f = ( AffineMap (a,b) |].-infty,(q-b)/(a-p).[ )
 +* ( AffineMap (p,q) |[.(q-b)/(a-p),+infty.[ );
 assume (q-b)/(a-p) in A; then
 (q-b)/(a-p) in [.(lower_bound A),(upper_bound A).] by INTEGRA1:4;
 then
 A4: (lower_bound A) <= (q-b)/(a-p) & (q-b)/(a-p) <= (upper_bound A)
   by XXREAL_1:1;
 set F = ( AffineMap (a,b) |[.lower_bound A,(q-b)/(a-p).] )
      +* ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] );
 A5: dom F = dom ( AffineMap (a,b) |[.lower_bound A,(q-b)/(a-p).] ) \/
 dom ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] ) by FUNCT_4:def 1
 .= [.lower_bound A,(q-b)/(a-p).]  \/
    dom ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] ) by FUNCT_2:def 1
 .= [.lower_bound A,(q-b)/(a-p).]  \/ [.(q-b)/(a-p),upper_bound A.]
    by FUNCT_2:def 1
 .= [.lower_bound A,upper_bound A.] by XXREAL_1:165,A4
 .= A by INTEGRA1:4
 .= dom (f | A) by FUNCT_2:def 1;
 for x being object st x in dom F holds F . x = (f | A) . x
 proof
  let x be object;
  assume A6: x in dom F; then
  reconsider x as Real by A5;
  x in A by A6,A5; then
  x in [.(lower_bound A),(upper_bound A).] by INTEGRA1:4;
  then
  A8: (lower_bound A) <= x & x <= (upper_bound A) by XXREAL_1:1;
  per cases;
  suppose B1: x < (q-b)/(a-p); then
   B3: not (x in dom ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] ))
              by XXREAL_1:1;
   B6: not ( x in dom (AffineMap (p,q) |[.(q-b)/(a-p),+infty.[))
           by XXREAL_1:236,B1;
   B0: F.x = (AffineMap (a,b) |[.lower_bound A,(q-b)/(a-p).]) .x
            by B3,FUNCT_4:11
   .= AffineMap (a,b) .x by FUNCT_1:49,A8,B1,XXREAL_1:1
   .= (AffineMap (a,b) | ].-infty,(q-b)/(a-p).[).x
           by FUNCT_1:49,XXREAL_1:233,B1;
   (f | A) . x  = (( AffineMap (a,b) |].-infty,(q-b)/(a-p).[ )
    +* ( AffineMap (p,q) |[.(q-b)/(a-p),+infty.[ )).x by A2,FUNCT_1:49,A6,A5;
   hence thesis by B0, B6,FUNCT_4:11;
  end;
  suppose C1: x >= (q-b)/(a-p); then
   x in [.(q-b)/(a-p),upper_bound A.] by A8; then
   C2: x in dom ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] )
              by FUNCT_2:def 1;
   x in [.(q-b)/(a-p),+infty.[ by XXREAL_1:236,C1;then
   C3: x in dom (AffineMap (p,q) |[.(q-b)/(a-p),+infty.[)
           by FUNCT_2:def 1;
   F . x
    = ( AffineMap (p,q) |[.(q-b)/(a-p),upper_bound A.] ).x by C2,FUNCT_4:13
   .= AffineMap (p,q) .x by FUNCT_1:49,A8,C1,XXREAL_1:1
   .= (AffineMap (p,q) |[.(q-b)/(a-p),+infty.[).x by FUNCT_1:49,XXREAL_1:236,C1
   .= f.x by A2,FUNCT_4:13,C3;
   hence thesis by FUNCT_1:49,A6,A5;
  end;
 end;
 hence thesis by FUNCT_1:2,A5;
end;
