let Z be open Subset of REAL; :: thesis: for f being PartFunc of REAL,REAL st Z c= dom f & ex r being Real st rng f = {r} holds
( f is_differentiable_on Z & ( for x being Real st x in Z holds
(f `| Z) . x = 0 ) )

let f be PartFunc of REAL,REAL; :: thesis: ( Z c= dom f & ex r being Real st rng f = {r} implies ( f is_differentiable_on Z & ( for x being Real st x in Z holds
(f `| Z) . x = 0 ) ) )

reconsider cf = REAL --> (In (0,REAL)) as Function of REAL,REAL ;
set R = cf;
now :: thesis: for h being non-zero 0 -convergent Real_Sequence holds
( (h ") (#) (cf /* h) is convergent & lim ((h ") (#) (cf /* h)) = 0 )
let h be non-zero 0 -convergent Real_Sequence; :: thesis: ( (h ") (#) (cf /* h) is convergent & lim ((h ") (#) (cf /* h)) = 0 )
A2: now :: thesis: for n being Nat holds ((h ") (#) (cf /* h)) . n = 0
let n be Nat; :: thesis: ((h ") (#) (cf /* h)) . n = 0
A4: rng h c= dom cf ;
A5: n in NAT by ORDINAL1:def 12;
thus ((h ") (#) (cf /* h)) . n = ((h ") . n) * ((cf /* h) . n) by SEQ_1:8
.= ((h ") . n) * (cf . (h . n)) by A5, A4, FUNCT_2:108
.= ((h ") . n) * 0
.= 0 ; :: thesis: verum
end;
then A6: (h ") (#) (cf /* h) is constant by VALUED_0:def 18;
hence (h ") (#) (cf /* h) is convergent ; :: thesis: lim ((h ") (#) (cf /* h)) = 0
((h ") (#) (cf /* h)) . 0 = 0 by A2;
hence lim ((h ") (#) (cf /* h)) = 0 by A6, SEQ_4:25; :: thesis: verum
end;
then reconsider R = cf as RestFunc by Def2;
set L = cf;
for p being Real holds cf . p = 0 * p ;
then reconsider L = cf as LinearFunc by Def3;
assume A7: Z c= dom f ; :: thesis: ( for r being Real holds not rng f = {r} or ( f is_differentiable_on Z & ( for x being Real st x in Z holds
(f `| Z) . x = 0 ) ) )

given r being Real such that A8: rng f = {r} ; :: thesis: ( f is_differentiable_on Z & ( for x being Real st x in Z holds
(f `| Z) . x = 0 ) )

A9: now :: thesis: for x0 being Real st x0 in dom f holds
f . x0 = r
let x0 be Real; :: thesis: ( x0 in dom f implies f . x0 = r )
assume x0 in dom f ; :: thesis: f . x0 = r
then f . x0 in {r} by A8, FUNCT_1:def 3;
hence f . x0 = r by TARSKI:def 1; :: thesis: verum
end;
A10: now :: thesis: for x0 being Real st x0 in Z holds
f is_differentiable_in x0
let x0 be Real; :: thesis: ( x0 in Z implies f is_differentiable_in x0 )
assume A11: x0 in Z ; :: thesis: f is_differentiable_in x0
then consider N being Neighbourhood of x0 such that
A12: N c= Z by RCOMP_1:18;
A13: N c= dom f by A7, A12;
for x being Real st x in N holds
(f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0))
proof
let x be Real; :: thesis: ( x in N implies (f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0)) )
reconsider xx = x, xx0 = x0 as Element of REAL by XREAL_0:def 1;
assume x in N ; :: thesis: (f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0))
hence (f . x) - (f . x0) = r - (f . x0) by A9, A13
.= r - r by A7, A9, A11
.= (L . (xx - xx0)) + 0
.= (L . (x - x0)) + (R . (x - x0)) ;
:: thesis: verum
end;
hence f is_differentiable_in x0 by A13; :: thesis: verum
end;
hence A14: f is_differentiable_on Z by A7, Th9; :: thesis: for x being Real st x in Z holds
(f `| Z) . x = 0

let x0 be Real; :: thesis: ( x0 in Z implies (f `| Z) . x0 = 0 )
assume A15: x0 in Z ; :: thesis: (f `| Z) . x0 = 0
then A16: f is_differentiable_in x0 by A10;
then ex N being Neighbourhood of x0 st
( N c= dom f & ex L being LinearFunc ex R being RestFunc st
for x being Real st x in N holds
(f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0)) ) ;
then consider N being Neighbourhood of x0 such that
A17: N c= dom f ;
A18: for x being Real st x in N holds
(f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0))
proof
let x be Real; :: thesis: ( x in N implies (f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0)) )
reconsider xx = x, xx0 = x0 as Element of REAL by XREAL_0:def 1;
assume x in N ; :: thesis: (f . x) - (f . x0) = (L . (x - x0)) + (R . (x - x0))
hence (f . x) - (f . x0) = r - (f . x0) by A9, A17
.= r - r by A7, A9, A15
.= (L . (xx - xx0)) + 0
.= (L . (x - x0)) + (R . (x - x0)) ;
:: thesis: verum
end;
reconsider j = 1 as Element of REAL by XREAL_0:def 1;
thus (f `| Z) . x0 = diff (f,x0) by A14, A15, Def7
.= L . j by A16, A17, A18, Def5
.= 0 ; :: thesis: verum