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
  a <= b & [' a,b '] c= dom f & f|[' a,b '] is continuous &
  ]. a,b .[ c= dom F &
  (for x be Real st x in ].a,b.[ holds F.x = integral(f,a,x) + F.a)
    implies F is_integral_of f,]. a,b .[
proof
  set O = ].a,b.[;
  assume that
A1: a <= b and
A2: [' a,b '] c= dom f and
A3: f|[' a,b '] is continuous and
A4: ]. a,b .[ c= dom F and
A5: for x be Real st x in ].a,b.[ holds F.x = integral(f,a,x) +F. a;
  dom(F|O) = dom F /\ O by PARTFUN2:15;
  then
A6: dom(F|O) = O by A4,XBOOLE_1:28;
   reconsider Fa = F.a as Element of REAL by XREAL_0:def 1;
  set H1 = REAL --> Fa;
  deffunc G0(Real) = In(integral(f,a,$1),REAL);
  consider G1 be Function of REAL,REAL such that
A7: for h be Element of REAL holds G1.h=G0(h) from FUNCT_2:sch 4;
  reconsider H=H1|O as PartFunc of REAL,REAL;
  reconsider G=G1|O as PartFunc of REAL,REAL;
  dom H = dom H1 /\ O by RELAT_1:61;
  then
A8: dom H = REAL /\ O by FUNCT_2:def 1;
  then
A9: dom H = O by XBOOLE_1:28;
  now
    let x be Element of REAL;
    reconsider z=x as Real;
    assume
A10: x in O /\ dom H;
    then H.x = H1.z by A9,FUNCT_1:47;
    then H.x = F.a by FUNCOP_1:7;
    hence H/.x = F.a by A9,A10,PARTFUN1:def 6;
  end;
  then
A11: H|O is constant by PARTFUN2:35;
  then
A12: H is_differentiable_on O by A9,FDIFF_1:22;
  dom G = dom G1 /\ O by RELAT_1:61;
  then
A13: dom G = REAL /\ O by FUNCT_2:def 1;
  then
A14: O = dom G by XBOOLE_1:28;
A15: now
    let x be Real;
    reconsider z = x as Element of REAL by XREAL_0:def 1;
    assume x in ].a,b.[;
    then G.x = G1.x by A14,FUNCT_1:47;
    then G.x = G0(z) by A7;
    hence G.x = integral(f,a,x);
  end;
A16: now
    let x be object;
    assume
A17: x in dom(F|O);
    then reconsider z=x as Real;
    reconsider z1=z as Element of REAL by XREAL_0:def 1;
    H.x = H1.z1 by A9,A6,A17,FUNCT_1:47;
    then
A18: H.x = F.a by FUNCOP_1:7;
    (F|O).x = F.z by A17,FUNCT_1:47;
    then (F|O).x = integral(f,a,z) + F.a by A5,A6,A17;
    hence (F|O).x = G.x + H.x by A15,A6,A17,A18;
  end;
A19: [' a,b '] = [.a,b.] by A1,INTEGRA5:def 3;
  then
A20: O c= [' a,b '] by XXREAL_1:25; then
A21: O c= dom f by A2;
A22: for x be Real st x in O holds G is_differentiable_in x & diff(G,x)=f.x
  proof
    let x be Real;
    reconsider z = x as Real;
A23: f|O is continuous by A3,A19,FCONT_1:16,XXREAL_1:25;
    assume
A24: x in ]. a,b .[;
    then x in dom(f|O) by A21,RELAT_1:57;
    then
A25: f|O is_continuous_in z by A23;
    for r be Real st 0 < r ex s be Real st 0 < s & for x1
    be Real st x1 in dom f & |.x1-z.| < s holds |.f.x1 - f.z.| < r
    proof
      let r be Real;
      consider ss1 be Real such that
A26:  0 < ss1 and
A27:  ].z-ss1,z+ss1.[ c= O by A24,RCOMP_1:19;
      assume 0 < r;
      then consider s be Real such that
A28:  0 < s and
A29:  for x1 be Real st x1 in dom(f|O) & |.x1-z.|<s holds
      |.(f| O).x1 - (f|O).z.| < r by A25,FCONT_1:3;
      set s1=min(ss1,s);
      take s1;
      now
        let x1 be Real;
        assume that
        x1 in dom f and
A30:    |.x1-z.|<s1;
        s1 <= s by XXREAL_0:17; then
A31:    |.x1-z.| < s by A30,XXREAL_0:2;
        O = O /\ dom f by A2,A20,XBOOLE_1:1,28; then
A32:    O = dom(f|O) by PARTFUN2:15;
        s1 <= ss1 by XXREAL_0:17;
        then |.x1-z.| < ss1 by A30,XXREAL_0:2;
        then
A33:    x1 in ].z-ss1,z+ss1.[ by RCOMP_1:1;
        then |.f.x1-f.z.| = |.(f|O).x1 - f.z.| by A27,A32,FUNCT_1:47;
        then |.f.x1-f.z.| = |.(f|O).x1 - (f|O).z.| by A24,A32,FUNCT_1:47;
        hence |.f.x1-f.z.|<r by A29,A27,A31,A33,A32;
      end;
      hence thesis by A28,A26,XXREAL_0:15;
    end;
    then
A34: f is_continuous_in z by FCONT_1:3;
    f|[' a,b '] is bounded & f is_integrable_on [' a,b '] by A2,A3,INTEGRA5:10
,11;
    hence thesis by A1,A2,A14,A15,A24,A34,INTEGRA6:28;
  end;
  then for x be Real st x in O holds G is_differentiable_in x;
  then
A35: G is_differentiable_on O by A14;
  dom(F|O)= dom G /\ dom H by A13,A8,A6,XBOOLE_1:28;
  then
A36: F|O = G+H by A16,VALUED_1:def 1;
  then F|O is_differentiable_on O by A35,A12,A6,FDIFF_1:18;
  then for x be Real st x in O holds F|O is_differentiable_in x;
  then
A37: F is_differentiable_on O by A4;
A38: now
    let x be Element of REAL;
    assume x in dom (F`|O);
    then
A39: x in O by A37,FDIFF_1:def 7;
    then x in dom f /\ O by A21,XBOOLE_0:def 4;
    then
A40: x in dom (f|O) by PARTFUN2:15;
    (F`|O).x = ((F|O)`|O).x by A37,FDIFF_2:16;
    then (F`|O).x = diff(G,x) + diff(H,x) by A35,A12,A6,A36,A39,FDIFF_1:18;
    then
A41: (F`|O).x = f.x + diff(H,x) by A22,A39;
    (H`|O).x = 0 by A9,A11,A39,FDIFF_1:22;
    then diff(H,x) = 0 by A12,A39,FDIFF_1:def 7;
    hence (F`|O).x = (f|O).x by A40,A41,FUNCT_1:47;
  end;
  dom(F`|O) = O by A37,FDIFF_1:def 7;
  then dom(F`|O) = O /\ dom f by A2,A20,XBOOLE_1:1,28;
  then dom(F`|O) = dom(f|O) by PARTFUN2:15;
  then F`|O = f|O by A38,PARTFUN1:5;
  hence thesis by A37,Lm1;
end;
