 reserve a,b,r for Real;
 reserve A for non empty set;
 reserve X,x for set;
 reserve f,g,F,G for PartFunc of REAL,REAL;
 reserve n for Element of NAT;

theorem Th1:
  for a,b,C be Real,
      u be PartFunc of REAL,REAL
  st a < b
   & ['a,b'] c= dom u & u is continuous
   & (for t be Real st t in ].a,b.[ holds u.t = C)
  holds
    for t be Real st t in ['a,b'] holds u.t = C
proof
  let a,b,C be Real,
      u be PartFunc of REAL,REAL;
  assume that
  A1: a < b & ['a,b'] c= dom u & u is continuous and
  A2: for t be Real st t in ].a,b.[ holds u.t = C;
  A3: ['a,b'] = [.a,b.] by A1,INTEGRA5:def 3; then
  A4: ].a,b.[ c= ['a,b'] by XXREAL_1:25;

  set z = a + (b-a)/2;
  A5: 0 < b-a by A1,XREAL_1:50; then
  (b-a)/2 < b-a by XREAL_1:216; then
  A7: z < b-a + a by XREAL_1:8;

  deffunc FF2(Nat) = In(((b-a)/2)/($1+1),REAL);
  consider Sn be Function of NAT,REAL such that
  A8: for x be Element of NAT holds Sn.x = FF2(x) from FUNCT_2:sch 4;

  A9: for n be Nat holds Sn.n = ((b-a)/2)/(n+1)
  proof
    let n be Nat;
    n in NAT by ORDINAL1:def 12;
    hence Sn.n
        = In(((b-a)/2)/(n+1),REAL) by A8
       .= ((b-a)/2)/(n+1);
  end; then
  A10: Sn is convergent & lim Sn = 0 by SEQ_4:31;

  consider Sa be constant Function of NAT,REAL such that
  A12: for x be Nat holds Sa.x = a by LmX;

  Sa.0 = a by A12; then
  A15: Sa is convergent & lim Sa = a by SEQ_4:25;
  set S0 = Sa+Sn;
  A17: lim S0 = a + 0 by A10,A15,SEQ_2:6
             .= a;
  a in [.a,b.] by A1; then
  A18: u is_continuous_in a by A1,A3;
  A19: rng S0 c= ].a,b.[
  proof
    let y be object;
    assume y in rng S0; then
    consider n be object such that
    A20: n in dom S0 & y = S0.n by FUNCT_1:def 3;

    reconsider n as Nat by A20;
    A21: y = Sa.n + Sn.n by A20,SEQ_1:7
          .= a + Sn.n by A12
          .= a + ((b-a)/2)/(n+1) by A9;
    A22: a + 0 < a + ((b-a)/2)/(n+1) by A5,XREAL_1:8;
    1 + 0 <= n+1 by XREAL_1:7; then
    ((b-a)/2)/(n+1) <= ((b-a)/2)/1 by A5,XREAL_1:118; then
    a + ((b-a)/2)/(n+1) <= a + ((b-a)/2) by XREAL_1:7; then
    a + ((b-a)/2)/(n+1) < b by A7,XXREAL_0:2;
    hence y in ].a,b.[ by A21,A22;
  end; then
  A23: rng S0 c= dom u by A1,A4; then
  A24: u/*S0 is convergent & u.a = lim(u/*S0) by A10,A17,A18;

  A25: for n be Nat holds (u/*S0).n = C
  proof
    let n be Nat;
    A26: n in NAT by ORDINAL1:def 12; then
    A27: (u/*S0).n = u.(S0.n) by A23,FUNCT_2:108;
    S0.n in rng S0 by A26,FUNCT_2:112;
    hence thesis by A2,A19,A27;
  end;

  for x, y be object st x in dom(u/*S0) & y in dom(u/*S0)
  holds (u/*S0).x = (u/*S0).y
  proof
    let x, y be object;
    assume x in dom(u/*S0) & y in dom(u/*S0);
    then reconsider x0=x,y0=y as Element of NAT;
    thus (u/*S0).x = (u/*S0).x0
                  .= C by A25
                  .= (u/*S0).y0 by A25
                  .= (u/*S0).y;
  end; then
  A28: u/*S0 is constant by FUNCT_1:def 10;
  A29: (u/*S0).0 = C by A25;

  consider Sb be constant Function of NAT,REAL such that
  A30: for x be Nat holds Sb.x = b by LmX;
  A33: Sb.0 = b by A30;

  set S1 = Sb - Sn;

  S1 is convergent & lim S1 = lim Sb - lim Sn by A10,SEQ_2:12; then
  A35: lim S1 = b by A10,A33,SEQ_4:25;

  b in [.a,b.] by A1; then
  A36: u is_continuous_in b by A1,A3;

  A37: rng S1 c= ].a,b.[
  proof
    let y be object;
    assume y in rng S1; then
    consider n be object such that
    A38: n in dom S1 & y = S1.n by FUNCT_1:def 3;
    reconsider n as Nat by A38;
    A39: y = Sb.n + (-Sn).n by A38,SEQ_1:7
          .= Sb.n - Sn.n by SEQ_1:10
          .= b - Sn.n by A30
          .= b - ((b-a)/2)/(n+1) by A9;
    A40: b - ((b-a)/2)/(n+1) < b - 0 by A5,XREAL_1:15;
    1 + 0 <= n+1 by XREAL_1:7; then
    ((b-a)/2)/(n+1) <= ((b-a)/2)/1 by A5,XREAL_1:118; then
    A41: b - ((b-a)/2) <= b - ((b-a)/2)/(n+1) by XREAL_1:13;
    a + 0 < a + (b-a)/2 by A5,XREAL_1:8; then
    a < b - ((b-a)/2)/(n+1) by A41,XXREAL_0:2;
    hence y in ].a,b.[ by A39,A40;
  end; then
  A42: rng S1 c= dom u by A1,A4; then
  A43: u/*S1 is convergent & u.b = lim (u/*S1) by A10,A35,A36;

  A44: for n be Nat holds (u/*S1).n = C
  proof
    let n be Nat;
    A45: n in NAT by ORDINAL1:def 12; then
    A46:(u/*S1).n = u.(S1.n) by A42,FUNCT_2:108;
    S1.n in ].a,b.[ by A37,A45,FUNCT_2:112;
    hence thesis by A2,A46;
  end;

  for x,y be object st x in dom(u/*S1) & y in dom(u/*S1)
  holds (u/*S1).x = (u/*S1).y
  proof
    let x,y be object;
    assume x in dom(u/*S1) & y in dom(u/*S1);
    then reconsider x0=x,y0=y as Element of NAT;
    thus (u/*S1).x = (u/*S1).x0
                  .= C by A44
                  .= (u/*S1).y0 by A44
                  .= (u/*S1).y;
  end; then
  A47: u/*S1 is constant by FUNCT_1:def 10;

  A48: (u/*S1).0 = C by A44;

  thus for t be Real st t in ['a,b'] holds u.t = C
  proof
    let t be Real;
    assume t in ['a,b']; then
    ex r be Real st t = r & a <= r <= b by A3; then

    per cases by XXREAL_0:1;
    suppose
      t = a;
      hence u.t = C by A24,A28,A29,SEQ_4:25;
    end;
    suppose
      a < t < b;
      then t in ].a,b.[;
      hence u.t = C by A2;
    end;
    suppose t = b;
      hence u.t = C by A43,A47,A48,SEQ_4:25;
    end;
  end;
end;
