 reserve h,h1 for 0-convergent non-zero Real_Sequence,
         c,c1 for constant Real_Sequence;

theorem
  for f,F,G be PartFunc of REAL,REAL, I be non empty Interval st
   F is_antiderivative_of f,I & G is_antiderivative_of f,I
   ex c be Real st for x be Real st x in I holds F.x = G.x + c
proof
    let f,F,G be PartFunc of REAL,REAL,
    I be non empty Interval;
    assume that
A1:  F is_antiderivative_of f,I and
A2:  G is_antiderivative_of f,I;

A3: inf I < sup I by A1,FDIFF_12:def 1;

    reconsider J = ].inf I,sup I.[ as non empty Subset of REAL
      by A3,XXREAL_1:33;
    inf I is R_eal & sup I is R_eal by XXREAL_0:def 1; then
    reconsider J as non empty open_interval Subset of REAL
      by MEASURE5:def 2;

    J = ].inf J,sup J.[ by MEASURE6:16; then
    inf J < sup J by XXREAL_1:28; then
    F is_antiderivative_of f,J & G is_antiderivative_of f,J
     by A1,A2,Th42,FDIFF_12:2; then
    consider c be Real such that
A4:  for x be Real st x in J holds F.x = G.x + c by Lm5;
    take c;

    I c= dom F & I c= dom G by A1,A2,FDIFF_12:def 1; then
A5: I = dom(F|I) & I = dom(G|I) by RELAT_1:62;

    per cases by MEASURE5:1;
    suppose I is open_interval; then
     I = ].inf I,sup I.[ by MEASURE6:16;
     hence for x be Real st x in I holds F.x = G.x + c by A4;
    end;
    suppose I is closed_interval; then
A6:  I = [.inf I,sup I.] by MEASURE6:17; then
A7:  inf I in I & sup I in I by A3,XXREAL_1:1;
A8:  inf I = lower_bound I & sup I = upper_bound I
       by A3,A6,Th1,Th2,XXREAL_1:1; then
     (F|I) is_continuous_in lower_bound I &
     (F|I) is_continuous_in upper_bound I &
     (G|I) is_continuous_in lower_bound I &
     (G|I) is_continuous_in upper_bound I
       by A5,A7,A1,A2,FDIFF_12:37,FCONT_1:def 2; then
A9:  (F|I) is_Rcontinuous_in lower_bound I &
     (F|I) is_Lcontinuous_in upper_bound I &
     (G|I) is_Rcontinuous_in lower_bound I &
     (G|I) is_Lcontinuous_in upper_bound I by A5,A7,A8,FDIFF_12:26;

A10:  for r be Real st r < upper_bound I
      ex g be Real st r < g & g < upper_bound I & g in dom(F|I)
     proof
      let r be Real;
      assume A11: r < upper_bound I;
      set r1 = max(r,lower_bound I);
      consider g be Real such that
A12:    r1 < g & g < upper_bound I by A11,A8,A3,XXREAL_0:29,XREAL_1:5;
      take g;
      r <= r1 & lower_bound I <= r1 by XXREAL_0:25; then
      r < g & lower_bound I < g by A12,XXREAL_0:2;
      hence r < g & g < upper_bound I & g in dom(F|I)
        by A12,A8,A6,A5,XXREAL_1:1;
     end; then
A13:  F|I is_left_convergent_in upper_bound I &
     lim_left(F|I,upper_bound I) = (F|I).(upper_bound I)
      by A9,FDIFF_12:30;
A14: G|I is_left_convergent_in upper_bound I &
     lim_left(G|I,upper_bound I) = (G|I).(upper_bound I)
      by A5,A9,A10,FDIFF_12:30;

     for e be Real st 0 < e
      ex x2 be Real st x2 < upper_bound I &
       for x be Real st x2 < x & x < upper_bound I & x in dom(F|I) holds
        |. (F|I).x - ((G|I).(upper_bound I)+c) .| < e
     proof
      let e be Real;
      assume 0 < e; then
      consider x1 be Real such that
A15:    x1 < upper_bound I &
       for x be Real st x1 < x & x < upper_bound I & x in dom(G|I) holds
        |. (G|I).x - (G|I).(upper_bound I) .| < e by A14,LIMFUNC2:41;
      set x2 = max(x1,lower_bound I);
      take x2;

      thus
       x2 < upper_bound I by A15,A3,A8,XXREAL_0:29;
      thus for x be Real st x2 < x & x < upper_bound I & x in dom(F|I) holds
       |. (F|I).x - ((G|I).(upper_bound I)+c) .| < e
      proof
       let x be Real;
       assume that
A16:     x2 < x and
A17:     x < upper_bound I and
A18:     x in dom(F|I);
       x1 <= x2 by XXREAL_0:25; then
A19:    x1 < x by A16,XXREAL_0:2;
       lower_bound I <= x2 by XXREAL_0:25; then
       lower_bound I < x by A16,XXREAL_0:2; then
       F.x = G.x + c by A4,A17,A8,XXREAL_1:4; then
       (F|I).x = G.x + c by A18,FUNCT_1:47; then
       (F|I).x = (G|I).x + c by A18,A5,FUNCT_1:47; then
       (F|I).x - ((G|I).(upper_bound I)+c)
        = (G|I).x - (G|I).(upper_bound I);
       hence thesis by A15,A17,A18,A19,A5;
      end;
     end; then
     (F|I).(upper_bound I) = (G|I).(upper_bound I) + c by A13,LIMFUNC2:41; then
A20: F.(upper_bound I) = (G|I).(upper_bound I) + c
       by A6,A8,A3,XXREAL_1:1,FUNCT_1:49;

A21:  for r be Real st lower_bound I < r
      ex g be Real st g < r & lower_bound I < g & g in dom(F|I)
     proof
      let r be Real;
      assume A22: lower_bound I < r;
      set r1 = min(r,upper_bound I);
      consider g be Real such that
A23:    lower_bound I < g & g < r1 by A22,A8,A3,XXREAL_0:21,XREAL_1:5;
      take g;
      r1 <= r & r1 <= upper_bound I by XXREAL_0:17; then
      g < r & g < upper_bound I by A23,XXREAL_0:2;
      hence g < r & lower_bound I < g & g in dom(F|I)
        by A6,A8,A5,A23,XXREAL_1:1;
     end; then
A24:  F|I is_right_convergent_in lower_bound I &
     lim_right(F|I,lower_bound I) = (F|I).(lower_bound I)
      by A9,FDIFF_12:31;
A25: G|I is_right_convergent_in lower_bound I &
     lim_right(G|I,lower_bound I) = (G|I).(lower_bound I)
      by A5,A9,A21,FDIFF_12:31;

     for e be Real st 0 < e
      ex x2 be Real st lower_bound I < x2 &
       for x be Real st x < x2 & lower_bound I < x & x in dom(F|I) holds
        |. (F|I).x - ((G|I).(lower_bound I)+c) .| < e
     proof
      let e be Real;
      assume 0 < e; then
      consider x1 be Real such that
A26:    lower_bound I < x1 &
       for x be Real st x < x1 & lower_bound I < x & x in dom(G|I) holds
        |. (G|I).x - (G|I).(lower_bound I) .| < e by A25,LIMFUNC2:42;
      set x2 = min(x1,upper_bound I);
      take x2;

      thus lower_bound I < x2 by A26,A3,A8,XXREAL_0:21;
      thus for x be Real st x < x2 & lower_bound I < x & x in dom(F|I) holds
       |. (F|I).x - ((G|I).(lower_bound I)+c) .| < e
      proof
       let x be Real;
       assume that
A27:     x < x2 and
A28:     lower_bound I < x and
A29:     x in dom(F|I);
       x2 <= x1 by XXREAL_0:17; then
A30:    x < x1 by A27,XXREAL_0:2;
       x2 <= upper_bound I by XXREAL_0:17; then
       x < upper_bound I by A27,XXREAL_0:2; then
       F.x = G.x + c by A4,A28,A8,XXREAL_1:4; then
       (F|I).x = G.x + c by A29,FUNCT_1:47; then
       (F|I).x = (G|I).x + c by A29,A5,FUNCT_1:47; then
       (F|I).x - ((G|I).(lower_bound I)+c)
        = (G|I).x - (G|I).(lower_bound I);
       hence thesis by A26,A28,A29,A30,A5;
      end;
     end; then
     (F|I).(lower_bound I) = (G|I).(lower_bound I) + c by A24,LIMFUNC2:42; then
A31: F.(lower_bound I) = (G|I).(lower_bound I) + c
       by A6,A8,A3,XXREAL_1:1,FUNCT_1:49;

     hereby let x be Real;
      assume x in I; then
A32:   lower_bound I <= x & x <= upper_bound I by A6,A8,XXREAL_1:1;
      now assume x <> lower_bound I & x <> upper_bound I; then
       lower_bound I < x & x < upper_bound I by A32,XXREAL_0:1;
       hence F.x = G.x + c by A4,A8,XXREAL_1:4;
      end;
      hence F.x = G.x + c by A20,A31,A6,A8,A3,XXREAL_1:1,FUNCT_1:49;
     end;
    end;
    suppose I is left_open_interval; then
A33:  I = ].inf I,sup I.] by MEASURE6:19; then
A34:  sup I in I by A3,XXREAL_1:2;
A35:  sup I = upper_bound I by A3,A33,Th2,XXREAL_1:2; then
     (F|I) is_continuous_in upper_bound I &
     (G|I) is_continuous_in upper_bound I
       by A5,A34,A1,A2,FDIFF_12:37,FCONT_1:def 2; then
A36:  (F|I) is_Lcontinuous_in upper_bound I &
     (G|I) is_Lcontinuous_in upper_bound I by A5,A34,A35,FDIFF_12:26;

A37:  for r be Real st r < upper_bound I
      ex g be Real st r < g & g < upper_bound I & g in dom(F|I)
     proof
      let r be Real;
      assume A38: r < upper_bound I;
      set r1 = max(r,inf I);
      r1 is R_eal & upper_bound I is R_eal by XXREAL_0:def 1; then
      consider g be Real such that
A39:    r1 < g & g < upper_bound I by A38,A35,A3,Th18,XXREAL_0:29;
      take g;
      r <= r1 & inf I <= r1 by XXREAL_0:25; then
      r < g & inf I < g by A39,XXREAL_0:2;
      hence r < g & g < upper_bound I & g in dom(F|I)
        by A33,A35,A5,A39,XXREAL_1:2;
     end; then
A40:  F|I is_left_convergent_in upper_bound I &
     lim_left(F|I,upper_bound I) = (F|I).(upper_bound I)
      by A36,FDIFF_12:30;
A41: G|I is_left_convergent_in upper_bound I &
     lim_left(G|I,upper_bound I) = (G|I).(upper_bound I)
      by A5,A36,A37,FDIFF_12:30;

     for e be Real st 0 < e
      ex x2 be Real st x2 < upper_bound I &
       for x be Real st x2 < x & x < upper_bound I & x in dom(F|I) holds
        |. (F|I).x - ((G|I).(upper_bound I)+c) .| < e
     proof
      let e be Real;
      assume 0 < e; then
      consider x1 be Real such that
A42:    x1 < upper_bound I &
       for x be Real st x1 < x & x < upper_bound I & x in dom(G|I) holds
        |. (G|I).x - (G|I).(upper_bound I) .| < e by A41,LIMFUNC2:41;
      set x2 = max(x1,inf I);
A43:   x1 <= x2 & x2 < upper_bound I by A42,A3,A35,XXREAL_0:25,29;
      -infty < x1 & upper_bound I < +infty by XREAL_0:def 1,XXREAL_0:9,12; then
      x2 in REAL by A43,XXREAL_0:14; then
      reconsider x2 as Real;
      take x2;

      thus x2 < upper_bound I by A42,A3,A35,XXREAL_0:29;
      thus for x be Real st x2 < x & x < upper_bound I & x in dom(F|I) holds
       |. (F|I).x - ((G|I).(upper_bound I)+c) .| < e
      proof
       let x be Real;
       assume that
A44:     x2 < x and
A45:     x < upper_bound I and
A46:     x in dom(F|I);
       x1 <= x2 by XXREAL_0:25; then
A47:    x1 < x by A44,XXREAL_0:2;
       inf I <= x2 by XXREAL_0:25; then
       inf I < x by A44,XXREAL_0:2; then
       F.x = G.x + c by A4,A45,A35,XXREAL_1:4; then
       (F|I).x = G.x + c by A46,FUNCT_1:47; then
       (F|I).x = (G|I).x + c by A46,A5,FUNCT_1:47; then
       (F|I).x - ((G|I).(upper_bound I)+c)
        = (G|I).x - (G|I).(upper_bound I);
       hence thesis by A42,A45,A46,A47,A5;
      end;
     end; then
     (F|I).(upper_bound I) = (G|I).(upper_bound I) + c by A40,LIMFUNC2:41; then
A48: F.(upper_bound I) = (G|I).(upper_bound I) + c
       by A33,A35,A3,XXREAL_1:2,FUNCT_1:49;

     hereby let x be Real;
      assume x in I; then
A49:   inf I < x & x <= upper_bound I by A33,A35,XXREAL_1:2;
      now assume x <> upper_bound I; then
       inf I < x & x < upper_bound I by A49,XXREAL_0:1;
       hence F.x = G.x + c by A4,A35,XXREAL_1:4;
      end;
      hence F.x = G.x + c by A48,A33,A35,A3,XXREAL_1:2,FUNCT_1:49;
     end;
    end;
    suppose I is right_open_interval; then
A50:  I = [.inf I,sup I.[ by MEASURE6:18; then
A51:  inf I in I by A3,XXREAL_1:3;
A52:  inf I = lower_bound I by A50,A3,Th1,XXREAL_1:3; then
     (F|I) is_continuous_in lower_bound I &
     (G|I) is_continuous_in lower_bound I
       by A5,A51,A1,A2,FDIFF_12:37,FCONT_1:def 2; then
A53:  (F|I) is_Rcontinuous_in lower_bound I &
     (G|I) is_Rcontinuous_in lower_bound I by A5,A51,A52,FDIFF_12:26;

A54:  for r be Real st lower_bound I < r
      ex g be Real st g < r & lower_bound I < g & g in dom(F|I)
     proof
      let r be Real;
      assume A55: lower_bound I < r;
      set r1 = min(r,sup I);
      r1 is R_eal & lower_bound I is R_eal by XXREAL_0:def 1; then
      consider g be Real such that
A56:    lower_bound I < g & g < r1 by A55,A52,A3,Th18,XXREAL_0:21;
      take g;
      r1 <= r & r1 <= sup I by XXREAL_0:17; then
      g < r & g < sup I by A56,XXREAL_0:2;
      hence g < r & lower_bound I < g & g in dom(F|I)
        by A52,A50,A5,A56,XXREAL_1:3;
     end; then
A57:  F|I is_right_convergent_in lower_bound I &
     lim_right(F|I,lower_bound I) = (F|I).(lower_bound I)
      by A53,FDIFF_12:31;
A58: G|I is_right_convergent_in lower_bound I &
     lim_right(G|I,lower_bound I) = (G|I).(lower_bound I)
      by A5,A53,A54,FDIFF_12:31;

     for e be Real st 0 < e
      ex x2 be Real st lower_bound I < x2 &
       for x be Real st x < x2 & lower_bound I < x & x in dom(F|I) holds
        |. (F|I).x - ((G|I).(lower_bound I)+c) .| < e
     proof
      let e be Real;
      assume 0 < e; then
      consider x1 be Real such that
A59:    lower_bound I < x1 &
       for x be Real st x < x1 & lower_bound I < x & x in dom(G|I) holds
        |. (G|I).x - (G|I).(lower_bound I) .| < e by A58,LIMFUNC2:42;
      set x2 = min(x1,sup I);
A60:   x2 <= x1 & lower_bound I < x2 by A59,A3,A52,XXREAL_0:17,21;
      x1 < +infty & lower_bound I > -infty by XREAL_0:def 1,XXREAL_0:9,12; then
      x2 in REAL by A60,XXREAL_0:14; then
      reconsider x2 as Real;
      take x2;

      thus lower_bound I < x2 by A59,A3,A52,XXREAL_0:21;
      thus for x be Real st x < x2 & lower_bound I < x & x in dom(F|I) holds
       |. (F|I).x - ((G|I).(lower_bound I)+c) .| < e
      proof
       let x be Real;
       assume that
A61:     x < x2 and
A62:     lower_bound I < x and
A63:     x in dom(F|I);
       x2 <= x1 by XXREAL_0:17; then
A64:    x < x1 by A61,XXREAL_0:2;
       x2 <= sup I by XXREAL_0:17; then
       x < sup I by A61,XXREAL_0:2; then
       F.x = G.x + c by A4,A62,A52,XXREAL_1:4; then
       (F|I).x = G.x + c by A63,FUNCT_1:47; then
       (F|I).x = (G|I).x + c by A63,A5,FUNCT_1:47; then
       (F|I).x - ((G|I).(lower_bound I)+c)
        = (G|I).x - (G|I).(lower_bound I);
       hence thesis by A59,A62,A63,A64,A5;
      end;
     end; then
     (F|I).(lower_bound I) = (G|I).(lower_bound I) + c by A57,LIMFUNC2:42; then
A65: F.(lower_bound I) = (G|I).(lower_bound I) + c
       by A50,A52,A3,XXREAL_1:3,FUNCT_1:49;

     hereby let x be Real;
      assume x in I; then
A66:   lower_bound I <= x & x < sup I by A50,A52,XXREAL_1:3;
      now assume x <> lower_bound I; then
       lower_bound I < x & x < sup I by A66,XXREAL_0:1;
       hence F.x = G.x + c by A4,A52,XXREAL_1:4;
      end;
      hence F.x = G.x + c by A65,A50,A52,A3,XXREAL_1:3,FUNCT_1:49;
     end;
    end;
end;
