let a, b be Real; :: thesis: for F being PartFunc of REAL ,REAL holds
( F is_convex_on [.a,b.] iff ( [.a,b.] c= dom F & ( for p being Real st 0 <= p & p <= 1 holds
for r, s being Real st r in [.a,b.] & s in [.a,b.] holds
F . ((p * r) + ((1 - p) * s)) <= (p * (F . r)) + ((1 - p) * (F . s)) ) ) )

let f be PartFunc of REAL ,REAL ; :: thesis: ( f is_convex_on [.a,b.] iff ( [.a,b.] c= dom f & ( for p being Real st 0 <= p & p <= 1 holds
for r, s being Real st r in [.a,b.] & s in [.a,b.] holds
f . ((p * r) + ((1 - p) * s)) <= (p * (f . r)) + ((1 - p) * (f . s)) ) ) )

set ab = { r where r is Real : ( a <= r & r <= b ) } ;
A1: [.a,b.] = { r where r is Real : ( a <= r & r <= b ) } by RCOMP_1:def 1;
thus ( f is_convex_on [.a,b.] implies ( [.a,b.] c= dom f & ( for p being Real st 0 <= p & p <= 1 holds
for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) ) ) ) :: thesis: ( [.a,b.] c= dom f & ( for p being Real st 0 <= p & p <= 1 holds
for r, s being Real st r in [.a,b.] & s in [.a,b.] holds
f . ((p * r) + ((1 - p) * s)) <= (p * (f . r)) + ((1 - p) * (f . s)) ) implies f is_convex_on [.a,b.] )
proof
assume A2: f is_convex_on [.a,b.] ; :: thesis: ( [.a,b.] c= dom f & ( for p being Real st 0 <= p & p <= 1 holds
for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) ) )

hence [.a,b.] c= dom f by Def13; :: thesis: for p being Real st 0 <= p & p <= 1 holds
for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y))

let p be Real; :: thesis: ( 0 <= p & p <= 1 implies for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) )

assume A3: ( 0 <= p & p <= 1 ) ; :: thesis: for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y))

then A4: 0 <= 1 - p by XREAL_1:50;
let x, y be Real; :: thesis: ( x in [.a,b.] & y in [.a,b.] implies f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) )
assume A5: ( x in [.a,b.] & y in [.a,b.] ) ; :: thesis: f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y))
then A6: ( ex r1 being Real st
( r1 = x & a <= r1 & r1 <= b ) & ex r2 being Real st
( r2 = y & a <= r2 & r2 <= b ) ) by A1;
then A7: ( p * a <= p * x & p * x <= p * b ) by A3, XREAL_1:66;
A8: ( (1 - p) * a <= (1 - p) * y & (1 - p) * y <= (1 - p) * b ) by A4, A6, XREAL_1:66;
(p * a) + ((1 - p) * a) = a ;
then A9: a <= (p * x) + ((1 - p) * y) by A7, A8, XREAL_1:9;
(p * b) + ((1 - p) * b) = b ;
then (p * x) + ((1 - p) * y) <= b by A7, A8, XREAL_1:9;
then (p * x) + ((1 - p) * y) in { r where r is Real : ( a <= r & r <= b ) } by A9;
hence f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) by A1, A2, A3, A5, Def13; :: thesis: verum
end;
assume A10: ( [.a,b.] c= dom f & ( for p being Real st 0 <= p & p <= 1 holds
for x, y being Real st x in [.a,b.] & y in [.a,b.] holds
f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) ) ) ; :: thesis: f is_convex_on [.a,b.]
hence [.a,b.] c= dom f ; :: according to RFUNCT_3:def 13 :: thesis: for p being Real st 0 <= p & p <= 1 holds
for r, s being Real st r in [.a,b.] & s in [.a,b.] & (p * r) + ((1 - p) * s) in [.a,b.] holds
f . ((p * r) + ((1 - p) * s)) <= (p * (f . r)) + ((1 - p) * (f . s))

let p be Real; :: thesis: ( 0 <= p & p <= 1 implies for r, s being Real st r in [.a,b.] & s in [.a,b.] & (p * r) + ((1 - p) * s) in [.a,b.] holds
f . ((p * r) + ((1 - p) * s)) <= (p * (f . r)) + ((1 - p) * (f . s)) )

assume A11: ( 0 <= p & p <= 1 ) ; :: thesis: for r, s being Real st r in [.a,b.] & s in [.a,b.] & (p * r) + ((1 - p) * s) in [.a,b.] holds
f . ((p * r) + ((1 - p) * s)) <= (p * (f . r)) + ((1 - p) * (f . s))

let x, y be Real; :: thesis: ( x in [.a,b.] & y in [.a,b.] & (p * x) + ((1 - p) * y) in [.a,b.] implies f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) )
assume ( x in [.a,b.] & y in [.a,b.] & (p * x) + ((1 - p) * y) in [.a,b.] ) ; :: thesis: f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y))
hence f . ((p * x) + ((1 - p) * y)) <= (p * (f . x)) + ((1 - p) * (f . y)) by A10, A11; :: thesis: verum