let X be non empty set ; :: thesis: for S being SigmaField of X
for f being PartFunc of X,ExtREAL st ex A being Element of S st
( A = dom f & f is_measurable_on A ) & f is nonnegative holds
ex F being Functional_Sequence of X,ExtREAL st
( ( for n being Nat holds
( F . n is_simple_func_in S & dom (F . n) = dom f ) ) & ( for n being Nat holds F . n is nonnegative ) & ( for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x ) & ( for x being Element of X st x in dom f holds
( F # x is convergent & lim (F # x) = f . x ) ) )

let S be SigmaField of X; :: thesis: for f being PartFunc of X,ExtREAL st ex A being Element of S st
( A = dom f & f is_measurable_on A ) & f is nonnegative holds
ex F being Functional_Sequence of X,ExtREAL st
( ( for n being Nat holds
( F . n is_simple_func_in S & dom (F . n) = dom f ) ) & ( for n being Nat holds F . n is nonnegative ) & ( for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x ) & ( for x being Element of X st x in dom f holds
( F # x is convergent & lim (F # x) = f . x ) ) )

let f be PartFunc of X,ExtREAL; :: thesis: ( ex A being Element of S st
( A = dom f & f is_measurable_on A ) & f is nonnegative implies ex F being Functional_Sequence of X,ExtREAL st
( ( for n being Nat holds
( F . n is_simple_func_in S & dom (F . n) = dom f ) ) & ( for n being Nat holds F . n is nonnegative ) & ( for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x ) & ( for x being Element of X st x in dom f holds
( F # x is convergent & lim (F # x) = f . x ) ) ) )

assume that
A1: ex A being Element of S st
( A = dom f & f is_measurable_on A ) and
A2: f is nonnegative ; :: thesis: ex F being Functional_Sequence of X,ExtREAL st
( ( for n being Nat holds
( F . n is_simple_func_in S & dom (F . n) = dom f ) ) & ( for n being Nat holds F . n is nonnegative ) & ( for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x ) & ( for x being Element of X st x in dom f holds
( F # x is convergent & lim (F # x) = f . x ) ) )

defpred S1[ Nat, PartFunc of X,ExtREAL] means ( dom $2 = dom f & ( for x being Element of X st x in dom f holds
( ( for k being Nat st 1 <= k & k <= (2 |^ $1) * $1 & (k - 1) / (2 |^ $1) <= f . x & f . x < k / (2 |^ $1) holds
$2 . x = (k - 1) / (2 |^ $1) ) & ( $1 <= f . x implies $2 . x = $1 ) ) ) );
A3: for n being Element of NAT ex y being Element of PFuncs (X,ExtREAL) st S1[n,y]
proof
let n be Element of NAT ; :: thesis: ex y being Element of PFuncs (X,ExtREAL) st S1[n,y]
defpred S2[ set , set ] means ( ( for k being Nat st 1 <= k & k <= (2 |^ n) * n & (k - 1) / (2 |^ n) <= f . $1 & f . $1 < k / (2 |^ n) holds
$2 = (k - 1) / (2 |^ n) ) & ( n <= f . $1 implies $2 = n ) );
A4: for x being set st x in dom f holds
ex y being set st S2[x,y]
proof
let x be set ; :: thesis: ( x in dom f implies ex y being set st S2[x,y] )
assume x in dom f ; :: thesis: ex y being set st S2[x,y]
per cases ( f . x < n or n <= f . x ) ;
suppose A5: f . x < n ; :: thesis: ex y being set st S2[x,y]
0 <= f . x by A2, SUPINF_2:70;
then consider k being Nat such that
1 <= k and
k <= (2 |^ n) * n and
A6: (k - 1) / (2 |^ n) <= f . x and
A7: f . x < k / (2 |^ n) by A5, Th8;
take y = (k - 1) / (2 |^ n); :: thesis: S2[x,y]
now
let k1 be Nat; :: thesis: ( 1 <= k1 & k1 <= (2 |^ n) * n & (k1 - 1) / (2 |^ n) <= f . x & f . x < k1 / (2 |^ n) implies y = (k1 - 1) / (2 |^ n) )
assume that
1 <= k1 and
k1 <= (2 |^ n) * n and
A8: (k1 - 1) / (2 |^ n) <= f . x and
A9: f . x < k1 / (2 |^ n) ; :: thesis: y = (k1 - 1) / (2 |^ n)
A10: now
assume k1 < k ; :: thesis: contradiction
then k1 + 1 <= k by NAT_1:13;
then k1 <= k - 1 by XREAL_1:21;
then k1 / (2 |^ n) <= (k - 1) / (2 |^ n) by XREAL_1:74;
hence contradiction by A6, A9, XXREAL_0:2; :: thesis: verum
end;
now
assume k < k1 ; :: thesis: contradiction
then k + 1 <= k1 by NAT_1:13;
then k <= k1 - 1 by XREAL_1:21;
then k / (2 |^ n) <= (k1 - 1) / (2 |^ n) by XREAL_1:74;
hence contradiction by A7, A8, XXREAL_0:2; :: thesis: verum
end;
hence y = (k1 - 1) / (2 |^ n) by A10, XXREAL_0:1; :: thesis: verum
end;
hence S2[x,y] by A5; :: thesis: verum
end;
suppose A11: n <= f . x ; :: thesis: ex y being set st S2[x,y]
reconsider y = n as Real ;
take y ; :: thesis: S2[x,y]
thus S2[x,y] by A11, Th9; :: thesis: verum
end;
end;
end;
consider fn being Function such that
A12: ( dom fn = dom f & ( for x being set st x in dom f holds
S2[x,fn . x] ) ) from CLASSES1:sch 1(A4);
now
let w be set ; :: thesis: ( w in rng fn implies b1 in ExtREAL )
assume w in rng fn ; :: thesis: b1 in ExtREAL
then consider v being set such that
A13: v in dom fn and
A14: w = fn . v by FUNCT_1:def 5;
per cases ( R_EAL n <= f . v or f . v < R_EAL n ) ;
suppose A15: f . v < R_EAL n ; :: thesis: b1 in ExtREAL
0 <= f . v by A2, SUPINF_2:70;
then consider k being Nat such that
A16: 1 <= k and
A17: k <= (2 |^ n) * n and
A18: (k - 1) / (2 |^ n) <= f . v and
A19: f . v < k / (2 |^ n) by A15, Th8;
fn . v = (k - 1) / (2 |^ n) by A12, A13, A16, A17, A18, A19;
hence w in ExtREAL by A14, XXREAL_0:def 1; :: thesis: verum
end;
end;
end;
then rng fn c= ExtREAL by TARSKI:def 3;
then reconsider fn = fn as PartFunc of (dom f),ExtREAL by A12, RELSET_1:11;
reconsider fn = fn as PartFunc of X,ExtREAL by A12, RELSET_1:13;
reconsider y = fn as Element of PFuncs (X,ExtREAL) by PARTFUN1:119;
take y ; :: thesis: S1[n,y]
thus S1[n,y] by A12; :: thesis: verum
end;
ex F being Function of NAT,(PFuncs (X,ExtREAL)) st
for n being Element of NAT holds S1[n,F . n] from FUNCT_2:sch 3(A3);
then consider F being Function of NAT,(PFuncs (X,ExtREAL)) such that
A20: for n being Element of NAT holds dom (F . n) = dom f and
A21: for n being Element of NAT
for x being Element of X st x in dom f holds
( ( for k being Nat st 1 <= k & k <= (2 |^ n) * n & (k - 1) / (2 |^ n) <= f . x & f . x < k / (2 |^ n) holds
(F . n) . x = (k - 1) / (2 |^ n) ) & ( n <= f . x implies (F . n) . x = n ) ) ;
A22: now
let n be Nat; :: thesis: dom (F . n) = dom f
n in NAT by ORDINAL1:def 13;
hence dom (F . n) = dom f by A20; :: thesis: verum
end;
reconsider F = F as Functional_Sequence of X,ExtREAL ;
consider A being Element of S such that
A23: A = dom f and
A24: f is_measurable_on A by A1;
A25: for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x
proof
let n, m be Nat; :: thesis: ( n <= m implies for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x )

assume A26: n <= m ; :: thesis: for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x

reconsider n = n, m = m as Element of NAT by ORDINAL1:def 13;
let x be Element of X; :: thesis: ( x in dom f implies (F . n) . x <= (F . m) . x )
assume A27: x in dom f ; :: thesis: (F . n) . x <= (F . m) . x
per cases ( R_EAL m <= f . x or f . x < R_EAL m ) ;
suppose A28: R_EAL m <= f . x ; :: thesis: (F . n) . x <= (F . m) . x
then A29: R_EAL n <= f . x by A26, XXREAL_0:2;
(F . m) . x = R_EAL m by A21, A27, A28;
hence (F . n) . x <= (F . m) . x by A21, A26, A27, A29; :: thesis: verum
end;
suppose A30: f . x < R_EAL m ; :: thesis: (F . n) . x <= (F . m) . x
A31: 0 <= f . x by A2, SUPINF_2:70;
then consider M being Nat such that
A32: 1 <= M and
A33: M <= (2 |^ m) * m and
A34: (M - 1) / (2 |^ m) <= f . x and
A35: f . x < M / (2 |^ m) by A30, Th8;
reconsider M = M as Element of NAT by ORDINAL1:def 13;
A36: (F . m) . x = (M - 1) / (2 |^ m) by A21, A27, A32, A33, A34, A35;
per cases ( R_EAL n <= f . x or f . x < R_EAL n ) ;
suppose A37: R_EAL n <= f . x ; :: thesis: (F . n) . x <= (F . m) . x
reconsider M1 = 2 |^ m as Element of NAT ;
n < M / (2 |^ m) by A35, A37, XXREAL_0:2;
then (2 |^ m) * n < M by PREPOWER:13, XREAL_1:81;
then (M1 * n) + 1 <= M by NAT_1:13;
then A38: M1 * n <= M - 1 by XREAL_1:21;
A39: 0 < 2 |^ m by PREPOWER:13;
(F . n) . x = R_EAL n by A21, A27, A37;
hence (F . n) . x <= (F . m) . x by A36, A39, A38, XREAL_1:79; :: thesis: verum
end;
suppose A40: f . x < R_EAL n ; :: thesis: (F . n) . x <= (F . m) . x
consider k being Nat such that
A41: m = n + k by A26, NAT_1:10;
reconsider k = k as Element of NAT by ORDINAL1:def 13;
reconsider K = 2 |^ k as Element of NAT ;
consider N1 being Nat such that
A42: 1 <= N1 and
A43: N1 <= (2 |^ n) * n and
A44: (N1 - 1) / (2 |^ n) <= f . x and
A45: f . x < N1 / (2 |^ n) by A31, A40, Th8;
reconsider N1 = N1 as Element of NAT by ORDINAL1:def 13;
A46: (F . n) . x = (N1 - 1) / (2 |^ n) by A21, A27, A42, A43, A44, A45;
R_EAL ((N1 - 1) / (2 |^ n)) < R_EAL (M / (2 |^ (n + k))) by A35, A44, A41, XXREAL_0:2;
then (N1 - 1) / (2 |^ n) < M / ((2 |^ n) * (2 |^ k)) by NEWTON:13;
then (N1 - 1) / (2 |^ n) < (M / (2 |^ k)) / (2 |^ n) by XCMPLX_1:79;
then N1 - 1 < M / (2 |^ k) by XREAL_1:74;
then K * (N1 - 1) < M by PREPOWER:13, XREAL_1:81;
then (K * (N1 - 1)) + 1 <= M by INT_1:20;
then K * (N1 - 1) <= M - 1 by XREAL_1:21;
then (K * (N1 - 1)) / (2 |^ (n + k)) <= (M - 1) / (2 |^ (n + k)) by XREAL_1:74;
then A47: (K * (N1 - 1)) / ((2 |^ n) * (2 |^ k)) <= (M - 1) / (2 |^ (n + k)) by NEWTON:13;
2 |^ k > 0 by PREPOWER:13;
hence (F . n) . x <= (F . m) . x by A36, A46, A41, A47, XCMPLX_1:92; :: thesis: verum
end;
end;
end;
end;
end;
A48: for n being Nat holds F . n is_simple_func_in S
proof
let n be Nat; :: thesis: F . n is_simple_func_in S
reconsider n = n as Element of NAT by ORDINAL1:def 13;
reconsider N = 2 |^ n as Element of NAT ;
defpred S2[ Nat, set ] means ( ( $1 <= N * n implies $2 = (A /\ (great_eq_dom (f,(R_EAL (($1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL ($1 / (2 |^ n))))) ) & ( $1 = (N * n) + 1 implies $2 = A /\ (great_eq_dom (f,(R_EAL n))) ) );
now
let x be Element of X; :: thesis: ( x in dom (F . n) implies |.((F . n) . b1).| < +infty )
assume x in dom (F . n) ; :: thesis: |.((F . n) . b1).| < +infty
then A49: x in dom f by A22;
per cases ( R_EAL n <= f . x or f . x < R_EAL n ) ;
suppose A50: R_EAL n <= f . x ; :: thesis: |.((F . n) . b1).| < +infty
then (F . n) . x = R_EAL n by A21, A49;
then A51: (F . n) . x < +infty by XXREAL_0:9;
- +infty < (F . n) . x by A21, A49, A50;
hence |.((F . n) . x).| < +infty by A51, EXTREAL2:59; :: thesis: verum
end;
suppose A52: f . x < R_EAL n ; :: thesis: |.((F . n) . b1).| < +infty
A53: 0 <= f . x by A2, SUPINF_2:70;
R_EAL n < +infty by XXREAL_0:9;
then reconsider y = f . x as Real by A52, A53, XXREAL_0:14;
set k = [\((2 |^ n) * y)/] + 1;
A54: [\((2 |^ n) * y)/] <= (2 |^ n) * y by INT_1:def 4;
((2 |^ n) * y) - 1 < [\((2 |^ n) * y)/] by INT_1:def 4;
then A55: (2 |^ n) * y < [\((2 |^ n) * y)/] + 1 by XREAL_1:21;
A56: 0 < 2 |^ n by PREPOWER:13;
then (2 |^ n) * y < (2 |^ n) * n by A52, XREAL_1:70;
then [\((2 |^ n) * y)/] < (2 |^ n) * n by A54, XXREAL_0:2;
then A57: [\((2 |^ n) * y)/] + 1 <= (2 |^ n) * n by INT_1:20;
A58: 0 <= (2 |^ n) * y by A53;
then A59: 0 + 1 <= [\((2 |^ n) * y)/] + 1 by A55, INT_1:20;
reconsider k = [\((2 |^ n) * y)/] + 1 as Element of NAT by A58, A55, INT_1:16;
k - 1 <= (2 |^ n) * y by INT_1:def 4;
then A60: (k - 1) / (2 |^ n) <= y by PREPOWER:13, XREAL_1:81;
y < k / (2 |^ n) by A56, INT_1:52, XREAL_1:83;
then A61: (F . n) . x = (k - 1) / (2 |^ n) by A21, A49, A59, A57, A60;
then -infty < (F . n) . x by XXREAL_0:12;
then A62: - +infty < (F . n) . x by XXREAL_3:def 3;
(F . n) . x < +infty by A61, XXREAL_0:9;
hence |.((F . n) . x).| < +infty by A62, EXTREAL2:59; :: thesis: verum
end;
end;
end;
then A63: F . n is V55() by MESFUNC2:def 1;
A64: now
let k be Nat; :: thesis: ( k in Seg ((N * n) + 1) implies ex B being Element of S st S2[B,b2] )
assume k in Seg ((N * n) + 1) ; :: thesis: ex B being Element of S st S2[B,b2]
reconsider k1 = k as Element of NAT by ORDINAL1:def 13;
per cases ( k <> (N * n) + 1 or k = (N * n) + 1 ) ;
suppose A65: k <> (N * n) + 1 ; :: thesis: ex B being Element of S st S2[B,b2]
set B = (A /\ (great_eq_dom (f,(R_EAL ((k1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k1 / (2 |^ n)))));
reconsider B = (A /\ (great_eq_dom (f,(R_EAL ((k1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k1 / (2 |^ n))))) as Element of S by A23, A24, Th39;
take B = B; :: thesis: S2[k,B]
thus S2[k,B] by A65; :: thesis: verum
end;
suppose A66: k = (N * n) + 1 ; :: thesis: ex B being Element of S st S2[B,b2]
set B = A /\ (great_eq_dom (f,(R_EAL n)));
reconsider B = A /\ (great_eq_dom (f,(R_EAL n))) as Element of S by A23, A24, MESFUNC1:31;
take B = B; :: thesis: S2[k,B]
thus S2[k,B] by A66, NAT_1:13; :: thesis: verum
end;
end;
end;
consider G being FinSequence of S such that
A67: ( dom G = Seg ((N * n) + 1) & ( for k being Nat st k in Seg ((N * n) + 1) holds
S2[k,G . k] ) ) from FINSEQ_1:sch 5(A64);
A68: now
let k be Nat; :: thesis: ( 1 <= k & k <= (2 |^ n) * n implies G . k = (A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k / (2 |^ n))))) )
assume that
A69: 1 <= k and
A70: k <= (2 |^ n) * n ; :: thesis: G . k = (A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k / (2 |^ n)))))
A71: k in NAT by ORDINAL1:def 13;
k <= (N * n) + 1 by A70, NAT_1:12;
then k in Seg ((N * n) + 1) by A69, A71;
hence G . k = (A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k / (2 |^ n))))) by A67, A70; :: thesis: verum
end;
A72: len G = ((2 |^ n) * n) + 1 by A67, FINSEQ_1:def 3;
now
let x, y be set ; :: thesis: ( x <> y implies G . b1 misses G . b2 )
assume A73: x <> y ; :: thesis: G . b1 misses G . b2
per cases ( not x in dom G or not y in dom G or ( x in dom G & y in dom G ) ) ;
suppose ( not x in dom G or not y in dom G ) ; :: thesis: G . b1 misses G . b2
then ( G . x = {} or G . y = {} ) by FUNCT_1:def 4;
hence G . x misses G . y by XBOOLE_1:65; :: thesis: verum
end;
suppose A74: ( x in dom G & y in dom G ) ; :: thesis: G . b1 misses G . b2
then reconsider x1 = x, y1 = y as Element of NAT ;
A75: x1 in Seg (len G) by A74, FINSEQ_1:def 3;
then A76: 1 <= x1 by FINSEQ_1:3;
A77: y1 in Seg (len G) by A74, FINSEQ_1:def 3;
then A78: 1 <= y1 by FINSEQ_1:3;
A79: y1 <= ((2 |^ n) * n) + 1 by A72, A77, FINSEQ_1:3;
A80: x1 <= ((2 |^ n) * n) + 1 by A72, A75, FINSEQ_1:3;
now
per cases ( x1 < y1 or y1 < x1 ) by A73, XXREAL_0:1;
case A81: x1 < y1 ; :: thesis: ( ( y1 = ((2 |^ n) * n) + 1 implies G . x misses G . y ) & ( y1 <> ((2 |^ n) * n) + 1 implies G . x misses G . y ) )
hereby :: thesis: ( y1 <> ((2 |^ n) * n) + 1 implies G . x misses G . y )
assume A82: y1 = ((2 |^ n) * n) + 1 ; :: thesis: G . x misses G . y
then A83: G . y = A /\ (great_eq_dom (f,(R_EAL n))) by A67, A74;
A84: x1 <= N * n by A81, A82, NAT_1:13;
then A85: G . x = (A /\ (great_eq_dom (f,(R_EAL ((x1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (x1 / (2 |^ n))))) by A68, A76;
now
assume ex v being set st v in (G . x) /\ (G . y) ; :: thesis: contradiction
then consider v being set such that
A86: v in (G . x) /\ (G . y) ;
v in G . y by A86, XBOOLE_0:def 4;
then v in great_eq_dom (f,(R_EAL n)) by A83, XBOOLE_0:def 4;
then A87: R_EAL n <= f . v by MESFUNC1:def 15;
v in G . x by A86, XBOOLE_0:def 4;
then v in less_dom (f,(R_EAL (x1 / (2 |^ n)))) by A85, XBOOLE_0:def 4;
then f . v < R_EAL (x1 / (2 |^ n)) by MESFUNC1:def 12;
then R_EAL n < R_EAL (x1 / (2 |^ n)) by A87, XXREAL_0:2;
hence contradiction by A84, PREPOWER:13, XREAL_1:81; :: thesis: verum
end;
then (G . x) /\ (G . y) = {} by XBOOLE_0:def 1;
hence G . x misses G . y by XBOOLE_0:def 7; :: thesis: verum
end;
assume y1 <> ((2 |^ n) * n) + 1 ; :: thesis: G . x misses G . y
then y1 < (N * n) + 1 by A79, XXREAL_0:1;
then A88: y1 <= N * n by NAT_1:13;
then x1 <= (2 |^ n) * n by A81, XXREAL_0:2;
then A89: G . x = (A /\ (great_eq_dom (f,(R_EAL ((x1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (x1 / (2 |^ n))))) by A68, A76;
A90: G . y = (A /\ (great_eq_dom (f,(R_EAL ((y1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (y1 / (2 |^ n))))) by A68, A78, A88;
now
assume ex v being set st v in (G . x) /\ (G . y) ; :: thesis: contradiction
then consider v being set such that
A91: v in (G . x) /\ (G . y) ;
v in G . y by A91, XBOOLE_0:def 4;
then v in A /\ (great_eq_dom (f,(R_EAL ((y1 - 1) / (2 |^ n))))) by A90, XBOOLE_0:def 4;
then v in great_eq_dom (f,(R_EAL ((y1 - 1) / (2 |^ n)))) by XBOOLE_0:def 4;
then A92: R_EAL ((y1 - 1) / (2 |^ n)) <= f . v by MESFUNC1:def 15;
v in G . x by A91, XBOOLE_0:def 4;
then v in less_dom (f,(R_EAL (x1 / (2 |^ n)))) by A89, XBOOLE_0:def 4;
then f . v < R_EAL (x1 / (2 |^ n)) by MESFUNC1:def 12;
then R_EAL ((y1 - 1) / (2 |^ n)) < R_EAL (x1 / (2 |^ n)) by A92, XXREAL_0:2;
then y1 - 1 < x1 by XREAL_1:74;
then y1 < x1 + 1 by XREAL_1:21;
hence contradiction by A81, NAT_1:13; :: thesis: verum
end;
then (G . x) /\ (G . y) = {} by XBOOLE_0:def 1;
hence G . x misses G . y by XBOOLE_0:def 7; :: thesis: verum
end;
case A93: y1 < x1 ; :: thesis: ( ( x1 <> ((2 |^ n) * n) + 1 implies G . x misses G . y ) & ( x1 = ((2 |^ n) * n) + 1 implies G . x misses G . y ) )
hereby :: thesis: ( x1 = ((2 |^ n) * n) + 1 implies G . x misses G . y )
assume x1 <> ((2 |^ n) * n) + 1 ; :: thesis: G . x misses G . y
then x1 < (N * n) + 1 by A80, XXREAL_0:1;
then A94: x1 <= N * n by NAT_1:13;
then y1 <= (2 |^ n) * n by A93, XXREAL_0:2;
then A95: G . y = (A /\ (great_eq_dom (f,(R_EAL ((y1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (y1 / (2 |^ n))))) by A68, A78;
A96: G . x = (A /\ (great_eq_dom (f,(R_EAL ((x1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (x1 / (2 |^ n))))) by A68, A76, A94;
now
assume ex v being set st v in (G . x) /\ (G . y) ; :: thesis: contradiction
then consider v being set such that
A97: v in (G . x) /\ (G . y) ;
v in G . x by A97, XBOOLE_0:def 4;
then v in A /\ (great_eq_dom (f,(R_EAL ((x1 - 1) / (2 |^ n))))) by A96, XBOOLE_0:def 4;
then v in great_eq_dom (f,(R_EAL ((x1 - 1) / (2 |^ n)))) by XBOOLE_0:def 4;
then A98: R_EAL ((x1 - 1) / (2 |^ n)) <= f . v by MESFUNC1:def 15;
v in G . y by A97, XBOOLE_0:def 4;
then v in less_dom (f,(R_EAL (y1 / (2 |^ n)))) by A95, XBOOLE_0:def 4;
then f . v < R_EAL (y1 / (2 |^ n)) by MESFUNC1:def 12;
then R_EAL ((x1 - 1) / (2 |^ n)) < R_EAL (y1 / (2 |^ n)) by A98, XXREAL_0:2;
then x1 - 1 < y1 by XREAL_1:74;
then x1 < y1 + 1 by XREAL_1:21;
hence contradiction by A93, NAT_1:13; :: thesis: verum
end;
then (G . x) /\ (G . y) = {} by XBOOLE_0:def 1;
hence G . x misses G . y by XBOOLE_0:def 7; :: thesis: verum
end;
assume A99: x1 = ((2 |^ n) * n) + 1 ; :: thesis: G . x misses G . y
then A100: G . x = A /\ (great_eq_dom (f,(R_EAL n))) by A67, A74;
A101: y1 <= N * n by A93, A99, NAT_1:13;
then A102: G . y = (A /\ (great_eq_dom (f,(R_EAL ((y1 - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (y1 / (2 |^ n))))) by A68, A78;
now
assume ex v being set st v in (G . x) /\ (G . y) ; :: thesis: contradiction
then consider v being set such that
A103: v in (G . x) /\ (G . y) ;
v in G . y by A103, XBOOLE_0:def 4;
then v in less_dom (f,(R_EAL (y1 / (2 |^ n)))) by A102, XBOOLE_0:def 4;
then A104: f . v < R_EAL (y1 / (2 |^ n)) by MESFUNC1:def 12;
v in G . x by A103, XBOOLE_0:def 4;
then v in great_eq_dom (f,(R_EAL n)) by A100, XBOOLE_0:def 4;
then R_EAL n <= f . v by MESFUNC1:def 15;
then R_EAL n < R_EAL (y1 / (2 |^ n)) by A104, XXREAL_0:2;
hence contradiction by A101, PREPOWER:13, XREAL_1:81; :: thesis: verum
end;
then (G . x) /\ (G . y) = {} by XBOOLE_0:def 1;
hence G . x misses G . y by XBOOLE_0:def 7; :: thesis: verum
end;
end;
end;
hence G . x misses G . y ; :: thesis: verum
end;
end;
end;
then reconsider G = G as Finite_Sep_Sequence of S by PROB_2:def 3;
A105: for k being Nat
for x, y being Element of X st k in dom G & x in G . k & y in G . k holds
(F . n) . x = (F . n) . y
proof
let k be Nat; :: thesis: for x, y being Element of X st k in dom G & x in G . k & y in G . k holds
(F . n) . x = (F . n) . y

let x, y be Element of X; :: thesis: ( k in dom G & x in G . k & y in G . k implies (F . n) . x = (F . n) . y )
assume that
A106: k in dom G and
A107: x in G . k and
A108: y in G . k ; :: thesis: (F . n) . x = (F . n) . y
A109: 1 <= k by A67, A106, FINSEQ_1:3;
A110: k <= (N * n) + 1 by A67, A106, FINSEQ_1:3;
now
per cases ( k = (N * n) + 1 or k <> (N * n) + 1 ) ;
suppose k <> (N * n) + 1 ; :: thesis: (F . n) . x = (F . n) . y
then k < (N * n) + 1 by A110, XXREAL_0:1;
then A115: k <= N * n by NAT_1:13;
then A116: G . k = (A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k / (2 |^ n))))) by A67, A106;
then x in less_dom (f,(R_EAL (k / (2 |^ n)))) by A107, XBOOLE_0:def 4;
then A117: f . x < R_EAL (k / (2 |^ n)) by MESFUNC1:def 12;
A118: x in A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n))))) by A107, A116, XBOOLE_0:def 4;
then x in great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))) by XBOOLE_0:def 4;
then A119: R_EAL ((k - 1) / (2 |^ n)) <= f . x by MESFUNC1:def 15;
x in A by A118, XBOOLE_0:def 4;
then A120: (F . n) . x = R_EAL ((k - 1) / (2 |^ n)) by A23, A21, A109, A115, A117, A119;
y in less_dom (f,(R_EAL (k / (2 |^ n)))) by A108, A116, XBOOLE_0:def 4;
then A121: f . y < R_EAL (k / (2 |^ n)) by MESFUNC1:def 12;
A122: y in A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n))))) by A108, A116, XBOOLE_0:def 4;
then y in great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))) by XBOOLE_0:def 4;
then A123: R_EAL ((k - 1) / (2 |^ n)) <= f . y by MESFUNC1:def 15;
y in A by A122, XBOOLE_0:def 4;
hence (F . n) . x = (F . n) . y by A23, A21, A109, A115, A121, A123, A120; :: thesis: verum
end;
end;
end;
hence (F . n) . x = (F . n) . y ; :: thesis: verum
end;
for v being set st v in dom f holds
v in union (rng G)
proof
let v be set ; :: thesis: ( v in dom f implies v in union (rng G) )
assume A124: v in dom f ; :: thesis: v in union (rng G)
ex B being set st
( v in B & B in rng G )
proof
per cases ( f . v < R_EAL n or R_EAL n <= f . v ) ;
suppose A125: f . v < R_EAL n ; :: thesis: ex B being set st
( v in B & B in rng G )

0 <= f . v by A2, SUPINF_2:70;
then consider k being Nat such that
A126: 1 <= k and
A127: k <= (2 |^ n) * n and
A128: (k - 1) / (2 |^ n) <= f . v and
A129: f . v < k / (2 |^ n) by A125, Th8;
v in great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))) by A124, A128, MESFUNC1:def 15;
then A130: v in A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n))))) by A23, A124, XBOOLE_0:def 4;
v in less_dom (f,(R_EAL (k / (2 |^ n)))) by A124, A129, MESFUNC1:def 12;
then A131: v in (A /\ (great_eq_dom (f,(R_EAL ((k - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (k / (2 |^ n))))) by A130, XBOOLE_0:def 4;
take G . k ; :: thesis: ( v in G . k & G . k in rng G )
A132: k in NAT by ORDINAL1:def 13;
N * n <= (N * n) + 1 by NAT_1:11;
then k <= (N * n) + 1 by A127, XXREAL_0:2;
then k in Seg ((N * n) + 1) by A126, A132;
hence ( v in G . k & G . k in rng G ) by A67, A127, A131, FUNCT_1:12; :: thesis: verum
end;
suppose A133: R_EAL n <= f . v ; :: thesis: ex B being set st
( v in B & B in rng G )

set k = (N * n) + 1;
take G . ((N * n) + 1) ; :: thesis: ( v in G . ((N * n) + 1) & G . ((N * n) + 1) in rng G )
1 <= (N * n) + 1 by NAT_1:11;
then A134: (N * n) + 1 in Seg ((N * n) + 1) ;
v in great_eq_dom (f,(R_EAL n)) by A124, A133, MESFUNC1:def 15;
then v in A /\ (great_eq_dom (f,(R_EAL n))) by A23, A124, XBOOLE_0:def 4;
hence ( v in G . ((N * n) + 1) & G . ((N * n) + 1) in rng G ) by A67, A134, FUNCT_1:12; :: thesis: verum
end;
end;
end;
hence v in union (rng G) by TARSKI:def 4; :: thesis: verum
end;
then A135: dom f c= union (rng G) by TARSKI:def 3;
for v being set st v in union (rng G) holds
v in dom f
proof
let v be set ; :: thesis: ( v in union (rng G) implies v in dom f )
assume v in union (rng G) ; :: thesis: v in dom f
then consider B being set such that
A136: v in B and
A137: B in rng G by TARSKI:def 4;
consider m being set such that
A138: m in dom G and
A139: B = G . m by A137, FUNCT_1:def 5;
reconsider m = m as Element of NAT by A138;
A140: m <= (N * n) + 1 by A67, A138, FINSEQ_1:3;
now
per cases ( m = (N * n) + 1 or m <> (N * n) + 1 ) ;
suppose m <> (N * n) + 1 ; :: thesis: v in A
then m < (N * n) + 1 by A140, XXREAL_0:1;
then m <= N * n by NAT_1:13;
then B = (A /\ (great_eq_dom (f,(R_EAL ((m - 1) / (2 |^ n)))))) /\ (less_dom (f,(R_EAL (m / (2 |^ n))))) by A67, A138, A139;
then v in A /\ (great_eq_dom (f,(R_EAL ((m - 1) / (2 |^ n))))) by A136, XBOOLE_0:def 4;
hence v in A by XBOOLE_0:def 4; :: thesis: verum
end;
end;
end;
hence v in dom f by A23; :: thesis: verum
end;
then union (rng G) c= dom f by TARSKI:def 3;
then union (rng G) = dom f by A135, XBOOLE_0:def 10;
then dom (F . n) = union (rng G) by A22;
hence F . n is_simple_func_in S by A63, A105, MESFUNC2:def 5; :: thesis: verum
end;
A141: now
let x be Element of X; :: thesis: ( x in dom f implies ( F # b1 is convergent & lim (F # b1) = f . b1 ) )
assume A142: x in dom f ; :: thesis: ( F # b1 is convergent & lim (F # b1) = f . b1 )
per cases ( |.(f . x).| = +infty or |.(f . x).| <> +infty ) ;
suppose A143: |.(f . x).| = +infty ; :: thesis: ( F # b1 is convergent & lim (F # b1) = f . b1 )
now
assume - (f . x) = +infty ; :: thesis: contradiction
then f . x < 0 ;
hence contradiction by A2, SUPINF_2:70; :: thesis: verum
end;
then A144: f . x = +infty by A143, EXTREAL2:50;
for g being real number st 0 < g holds
ex n being Nat st
for m being Nat st n <= m holds
g <= (F # x) . m
proof
let g be real number ; :: thesis: ( 0 < g implies ex n being Nat st
for m being Nat st n <= m holds
g <= (F # x) . m )

assume 0 < g ; :: thesis: ex n being Nat st
for m being Nat st n <= m holds
g <= (F # x) . m

then reconsider n = [/g\] as Nat by INT_1:80;
A145: g <= n by INT_1:def 5;
for m being Nat st n <= m holds
g <= (F # x) . m
proof
let m be Nat; :: thesis: ( n <= m implies g <= (F # x) . m )
assume n <= m ; :: thesis: g <= (F # x) . m
then A146: g <= m by A145, XXREAL_0:2;
reconsider m = m as Element of NAT by ORDINAL1:def 13;
R_EAL m <= f . x by A144, XXREAL_0:4;
then (F . m) . x = R_EAL m by A21, A142;
hence g <= (F # x) . m by A146, Def13; :: thesis: verum
end;
hence ex n being Nat st
for m being Nat st n <= m holds
g <= (F # x) . m ; :: thesis: verum
end;
then A147: F # x is convergent_to_+infty by Def9;
then F # x is convergent by Def11;
hence ( F # x is convergent & lim (F # x) = f . x ) by A144, A147, Def12; :: thesis: verum
end;
suppose |.(f . x).| <> +infty ; :: thesis: ( F # b1 is convergent & lim (F # b1) = f . b1 )
then reconsider g = f . x as Real by EXTREAL2:67, XXREAL_0:14;
A148: for p being real number st 0 < p holds
ex k being Nat st
for j being Nat st j >= k holds
|.(((F # x) . j) - (f . x)).| < p
proof
set N2 = [/g\] + 1;
let p be real number ; :: thesis: ( 0 < p implies ex k being Nat st
for j being Nat st j >= k holds
|.(((F # x) . j) - (f . x)).| < p )

A149: g <= [/g\] by INT_1:def 5;
[/g\] < [/g\] + 1 by XREAL_1:31;
then A150: g < [/g\] + 1 by A149, XXREAL_0:2;
0 <= g by A2, SUPINF_2:70;
then reconsider N2 = [/g\] + 1 as Element of NAT by A149, INT_1:16;
A151: for N being Nat st N >= N2 holds
|.(((F # x) . N) - (f . x)).| < 1 / (2 |^ N)
proof
let N be Nat; :: thesis: ( N >= N2 implies |.(((F # x) . N) - (f . x)).| < 1 / (2 |^ N) )
assume A152: N >= N2 ; :: thesis: |.(((F # x) . N) - (f . x)).| < 1 / (2 |^ N)
reconsider N = N as Element of NAT by ORDINAL1:def 13;
A153: 0 <= f . x by A2, SUPINF_2:70;
f . x < N by A150, A152, XXREAL_0:2;
then consider m being Nat such that
A154: 1 <= m and
A155: m <= (2 |^ N) * N and
A156: (m - 1) / (2 |^ N) <= f . x and
A157: f . x < m / (2 |^ N) by A153, Th8;
reconsider m = m as Element of NAT by ORDINAL1:def 13;
A158: (F # x) . N = (F . N) . x by Def13
.= (m - 1) / (2 |^ N) by A21, A142, A154, A155, A156, A157 ;
(R_EAL (m / (2 |^ N))) - (R_EAL ((m - 1) / (2 |^ N))) = (m / (2 |^ N)) - ((m - 1) / (2 |^ N)) by SUPINF_2:5
.= (m / (2 |^ N)) + (- ((m - 1) / (2 |^ N)))
.= (m / (2 |^ N)) + ((- (m - 1)) / (2 |^ N)) by XCMPLX_1:188
.= (m + (- (m - 1))) / (2 |^ N) by XCMPLX_1:63 ;
then A159: (f . x) - ((F # x) . N) < 1 / (2 |^ N) by A157, A158, XXREAL_3:47;
- (((F # x) . N) - (f . x)) = (f . x) - ((F # x) . N) by XXREAL_3:27;
then A160: |.(((F # x) . N) - (f . x)).| = |.((f . x) - ((F # x) . N)).| by EXTREAL2:66;
2 |^ N > 0 by PREPOWER:13;
then A161: - (R_EAL (1 / (2 |^ N))) < 0 ;
0 <= (f . x) - ((F # x) . N) by A156, A158, XXREAL_3:43;
hence |.(((F # x) . N) - (f . x)).| < 1 / (2 |^ N) by A160, A159, A161, EXTREAL2:59; :: thesis: verum
end;
assume 0 < p ; :: thesis: ex k being Nat st
for j being Nat st j >= k holds
|.(((F # x) . j) - (f . x)).| < p

then consider N1 being Element of NAT such that
A162: 1 / (2 |^ N1) <= p by PREPOWER:106;
reconsider k = max (N2,N1) as Element of NAT ;
A163: for k being Nat st k >= N1 holds
1 / (2 |^ k) <= p
proof
let k be Nat; :: thesis: ( k >= N1 implies 1 / (2 |^ k) <= p )
assume k >= N1 ; :: thesis: 1 / (2 |^ k) <= p
then consider i being Nat such that
A164: k = N1 + i by NAT_1:10;
(2 |^ N1) * (2 |^ i) >= 2 |^ N1 by PREPOWER:19, XREAL_1:153;
then A165: 2 |^ k >= 2 |^ N1 by A164, NEWTON:13;
2 |^ N1 > 0 by PREPOWER:19;
then (2 |^ k) " <= (2 |^ N1) " by A165, XREAL_1:87;
then 1 / (2 |^ k) <= (2 |^ N1) " by XCMPLX_1:217;
then 1 / (2 |^ k) <= 1 / (2 |^ N1) by XCMPLX_1:217;
hence 1 / (2 |^ k) <= p by A162, XXREAL_0:2; :: thesis: verum
end;
now
let j be Nat; :: thesis: ( j >= k implies |.(((F # x) . j) - (f . x)).| < p )
assume A166: j >= k ; :: thesis: |.(((F # x) . j) - (f . x)).| < p
k >= N2 by XXREAL_0:25;
then j >= N2 by A166, XXREAL_0:2;
then A167: |.(((F # x) . j) - (f . x)).| < R_EAL (1 / (2 |^ j)) by A151;
k >= N1 by XXREAL_0:25;
then j >= N1 by A166, XXREAL_0:2;
then 1 / (2 |^ j) <= p by A163;
hence |.(((F # x) . j) - (f . x)).| < p by A167, XXREAL_0:2; :: thesis: verum
end;
hence ex k being Nat st
for j being Nat st j >= k holds
|.(((F # x) . j) - (f . x)).| < p ; :: thesis: verum
end;
A168: f . x = R_EAL g ;
then A169: F # x is convergent_to_finite_number by A148, Def8;
then F # x is convergent by Def11;
hence ( F # x is convergent & lim (F # x) = f . x ) by A168, A148, A169, Def12; :: thesis: verum
end;
end;
end;
for n being Nat holds F . n is nonnegative
proof
let n be Nat; :: thesis: F . n is nonnegative
reconsider n = n as Element of NAT by ORDINAL1:def 13;
now
let x be set ; :: thesis: ( x in dom (F . n) implies 0 <= (F . n) . b1 )
assume x in dom (F . n) ; :: thesis: 0 <= (F . n) . b1
then A170: x in dom f by A22;
per cases ( n <= f . x or f . x < n ) ;
suppose n <= f . x ; :: thesis: 0 <= (F . n) . b1
hence 0 <= (F . n) . x by A21, A170; :: thesis: verum
end;
suppose A171: f . x < n ; :: thesis: 0 <= (F . n) . b1
0 <= f . x by A2, SUPINF_2:70;
then consider k being Nat such that
A172: 1 <= k and
A173: k <= (2 |^ n) * n and
A174: (k - 1) / (2 |^ n) <= f . x and
A175: f . x < k / (2 |^ n) by A171, Th8;
0 <= k - 1 by A172, XREAL_1:50;
hence 0 <= (F . n) . x by A21, A170, A172, A173, A174, A175; :: thesis: verum
end;
end;
end;
hence F . n is nonnegative by SUPINF_2:71; :: thesis: verum
end;
hence ex F being Functional_Sequence of X,ExtREAL st
( ( for n being Nat holds
( F . n is_simple_func_in S & dom (F . n) = dom f ) ) & ( for n being Nat holds F . n is nonnegative ) & ( for n, m being Nat st n <= m holds
for x being Element of X st x in dom f holds
(F . n) . x <= (F . m) . x ) & ( for x being Element of X st x in dom f holds
( F # x is convergent & lim (F # x) = f . x ) ) ) by A22, A48, A25, A141; :: thesis: verum